Rewrite `stunnerctl` in Go
Closed this issue · 5 comments
This issue tracks the progress on rewriting stunnerctl
in Go.
stunnerctl is a small CLI utility that simplifies the interaction with STUNner. Currently it offers a single command, stunnerctl running-config
, which allows to dump a gateway hierarchy in a human readable form. In the long run, stunnerctl
will obtain further features, like
stunnerctl version/status
to get current cluster-wide STUNner version and status,stunnerctl config
as a fancier form of the currentrunning-config
functionality,stunnerctl install
to install STUNner via the CLI,stunnerctl monitor/dashboard
for monitoring, andstunnerctl connect
to control multicluster STUNner (once we implement it).
In addition, stunnerctl
will need to provide the standard kubectl
goodies, like support for taking Kubernetes config from KUBECONFIG
, --kubeconfig
, or --context
.
Currently stunnerctl
is a Bash script that talks to Kubernetes via kubectl
and parses JSON responses using jq
. Understandably, this is not really future-proof.
The goal is to rewrite stunnerctl
in Go using the standard Go CLI tooling (viper, cobra, etc.).
As a user, stunnerctl
works perfectly fine for me. turncat
, OTOH, being written in Go, is a source of problems.
hi @bananu7,
Great, happy to hear that stunnerctl
works well!
I am wondering whether releasing binaries for turncat
would help. What do you think?
@levaitamas You're actually releasing the binaries, just not advertising it :) https://hub.docker.com/r/l7mp/turncat
I was quite angry at it not working yesterday (as you can imagine), but being real for a second:
- it didn't compile on Windows because of platform specific API (I assume?)
.\uri.go:149:29: cannot use int(descriptor) (value of type int) as syscall.Handle value in argument to syscall.SetsockoptInt
- it didn't compile on Ubuntu because of...
non-pc-relative relocation address for go:info.int is too big
I'd happily build it but after two tries I kind of lost my patience. I think for most of Stunner's userbase the dockerized release is fine, if it's maintained and in the readme.
Hi @bananu7,
Wow, nice catch! 💯 We also have a net-debug image that has turncat built-in: https://hub.docker.com/r/l7mp/net-debug
Sorry about the build failures, and thank you for your feedback! TBH, we never tried to compile turncat
on Windows.
On Ubuntu/Alpine this should work on amd64 and arm64 machines (taken from the net-debug Dockerfile):
CGO_ENABLED=0 GOOS=linux go build -ldflags="-w -s" -trimpath -o turncat cmd/turncat/main.go
I think for most of Stunner's userbase the dockerized release is fine, if it's maintained and in the readme.
That's a good point. We will definitely mention it in the docs. Thanks!
As per the Windows compilation problem, I think it is indeed a platform issue. This is quite puzzling given that we deliberately use the syscall
package that is supposed to be portable across OSes, instead of golang.org/x/sys/unix
that contains the UNIX specific stuff. Maybe we could steal some ideas from go-reuse
to make turncat
really portable? Anyone care to submit a PR?