Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite stunnerctl in Go #81

Closed
rg0now opened this issue Apr 19, 2023 · 5 comments
Closed

Rewrite stunnerctl in Go #81

rg0now opened this issue Apr 19, 2023 · 5 comments
Labels

Comments

@rg0now
Copy link
Member

rg0now commented Apr 19, 2023

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 current running-config functionality,
  • stunnerctl install to install STUNner via the CLI,
  • stunnerctl monitor/dashboard for monitoring, and
  • stunnerctl 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.).

@rg0now rg0now added good first issue Good for newcomers priority: low type: enhancement Feature request labels Apr 19, 2023
@bananu7
Copy link

bananu7 commented Aug 15, 2023

As a user, stunnerctl works perfectly fine for me. turncat, OTOH, being written in Go, is a source of problems.

@levaitamas
Copy link
Member

hi @bananu7,

Great, happy to hear that stunnerctl works well!
I am wondering whether releasing binaries for turncat would help. What do you think?

@bananu7
Copy link

bananu7 commented Aug 16, 2023

@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.

@levaitamas
Copy link
Member

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!

@rg0now
Copy link
Member Author

rg0now commented Aug 17, 2023

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants