Index | Thread | Search

From:
Christoph Liebender <christoph@liebender.dev>
Subject:
Re: NEW: net/wstunnel
To:
Björn Ketelaars <bjorn.ketelaars@hydroxide.nl>
Cc:
ports@openbsd.org
Date:
Sat, 14 Dec 2024 22:37:12 +0100

Download raw body.

Thread
Am 14.12.24 um 19:01 schrieb Björn Ketelaars:
> On Sat 14/12/2024 14:35, Christoph Liebender wrote:
>> Am 14.12.24 um 13:26 schrieb Björn Ketelaars:
>>> On Sat 14/12/2024 00:08, Christoph Liebender wrote:
>>>> Hello there everyone.
>>>>
>>>> This is my first try at contributing to the OpenBSD ports tree:
>>>>
>>>> https://liebender.dev/patches/openbsd-ports/wstunnel-port.tar.gz
>>>>
>>>> wstunnel is useful in case you want to connect to your OpenBSD box, given
>>>> that
>>>> you are behind some firewall that restricts traffic to certain ports - for
>>>> example, you can configure wstunnel to listen on :443 and connect to your
>>>> box
>>>> via that port, to then route all your traffic to the wireguard interface of
>>>> your server. There are other usecases though, but this is my primary one.
>>>>
>>>> Now, there are two patches included, even though wstunnel compiles on
>>>> OpenBSD
>>>> amd64 just fine. I had to apply these because the original Cargo.toml
>>>> references a github repository as a crate: fastwebsockets. In this case, the
>>>> developer of wstunnel made changes to the original crate which they did not
>>>> (yet?) upstream, and their fork does not include any tags for the Cargo.toml
>>>> to reference. This is why I am patching Cargo.toml to reference the original
>>>> crate and then apply the changes of the wstunnel developer on top. I edited
>>>> crates.inc manually in this case to add fastwebsockets-0.8.0. Is there a
>>>> better
>>>> way? `make modcargo-gen-crates` apparently only reads the unpatched,
>>>> original
>>>> Cargo.toml.
>>>>
>>>> Anyway, I'm glad to receive any feedback or comments. Thanks.
>>>>
>>>> - Christoph
>>>
>>> Great start, thanks!
>>
>> Many thanks for your suggestions! The OpenBSD porting tools seem to be more
>> flexible than I initially thought :b
>>
>>> - wstunnel.rc feels incomplete: Please check if there are some sane/safe
>>>     daemon_flags that can be added. Also, check if rc_bg=YES is needed.
>>
>> Yes, I have checked again and there probably also needs to be `--no-color
>> true` because otherwise wstunnel would fill the log with escape-sequences.
>> Though, would it make sense to "enforce" this argument no matter what
>> deamon_flags are set? Does this need a custom rc_cmd?
>> And yes, rc_bg=YES is needed because wstunnel stays in the foreground.
>>
>> I have applied your changes and reuploaded a v2 tarball to:
>>
>> https://liebender.dev/pub/openbsd-ports/wstunnel-port-v2.tar.gz (it is also
>> attached for convenience)
>>
>> -#584 _nepenthes		_nepenthes	net/nepenthes
>> +584 _wstunnel		_wstunnel	net/wstunnel
> 
> Recycling id 584 should be ok.
> 
> Concerning the port itself, couple of things:
> - No need for the GH_* stuff. "DIST_TUPLE+=github erebe wstunnel v10.1.7
>    ." already does the heavy lifting.
> - As a consequence you need to re-run 'make makesum' as PLIST needs to
>    be updated.
> - Maybe make the --no-color flag default?
> 
> 
> diff -ruN wstunnel.orig/Makefile wstunnel/Makefile
> --- wstunnel.orig/Makefile	Sat Dec 14 13:47:35 2024
> +++ wstunnel/Makefile	Sat Dec 14 18:55:17 2024
> @@ -3,10 +3,6 @@
>   DIST_TUPLE +=		github erebe wstunnel v10.1.7 .
>   DIST_TUPLE +=		github erebe fastwebsockets ef904598ec168d7748b28d77ec1803ba721932d8 fastwebsockets
>   
> -GH_ACCOUNT =		erebe
> -GH_PROJECT =		wstunnel
> -GH_TAGNAME =		v10.1.7
> -
>   CATEGORIES =		net
>   
>   HOMEPAGE =		https://github.com/erebe/wstunnel
> diff -ruN wstunnel.orig/distinfo wstunnel/distinfo
> --- wstunnel.orig/distinfo	Sat Dec 14 14:22:21 2024
> +++ wstunnel/distinfo	Sat Dec 14 18:55:24 2024
> @@ -346,7 +346,6 @@
>   SHA256 (cargo/zerovec-derive-0.10.3.tar.gz) = bq+m37F1hOo+K9bnbgzBWtevErCavdHKVZYb7ZsQY8Y=
>   SHA256 (erebe-fastwebsockets-ef904598ec168d7748b28d77ec1803ba721932d8.tar.gz) = pTk3zyTTSZ0jr2ofJrFT4W3HZ15YwiySddSrPzmd6WY=
>   SHA256 (erebe-wstunnel-v10.1.7.tar.gz) = fMEWgfd+tQMxEzKZF0FQ7ekp7azzgbsGq3YgU3cLoDs=
> -SHA256 (wstunnel-10.1.7.tar.gz) = fMEWgfd+tQMxEzKZF0FQ7ekp7azzgbsGq3YgU3cLoDs=
>   SIZE (cargo/addr2line-0.24.2.tar.gz) = 39015
>   SIZE (cargo/adler2-2.0.0.tar.gz) = 13529
>   SIZE (cargo/ahash-0.8.11.tar.gz) = 43607
> @@ -695,4 +694,3 @@
>   SIZE (cargo/zerovec-derive-0.10.3.tar.gz) = 19438
>   SIZE (erebe-fastwebsockets-ef904598ec168d7748b28d77ec1803ba721932d8.tar.gz) = 57473
>   SIZE (erebe-wstunnel-v10.1.7.tar.gz) = 281043
> -SIZE (wstunnel-10.1.7.tar.gz) = 281043
> diff -ruN wstunnel.orig/pkg/wstunnel.rc wstunnel/pkg/wstunnel.rc
> --- wstunnel.orig/pkg/wstunnel.rc	Sat Dec 14 13:41:17 2024
> +++ wstunnel/pkg/wstunnel.rc	Sat Dec 14 18:56:03 2024
> @@ -1,9 +1,9 @@
>   #!/bin/ksh
>   
> -daemon="${TRUEPREFIX}/bin/wstunnel"
> +daemon="${TRUEPREFIX}/bin/wstunnel --no-color true"
>   daemon_user="_wstunnel"
>   daemon_logger="daemon.info"
> -daemon_flags="server wss://localhost:8080 --no-color true"
> +daemon_flags="server wss://localhost:8080"
>   
>   . /etc/rc.d/rc.subr
>   

Right, I missed removing the GH_* variables. And interestingly, adding 
`--no-color true` right before `client` or `server` works even though it 
is not documented that way...

I've applied your patch:

https://liebender.dev/pub/openbsd-ports/wstunnel-port-v3.tar.gz (attached)

OK?