Live data from Hacker News

Show HN: I made an SSH tunnel manager to learn Go

github.com

61–70 of 72 posts

Re: Show HN: I made an SSH tunnel manager to learn Go

#62
post #17

Well done. The ease of use and high quality of the Go SSH libraries (golang.org/x/crypto/ssh) is a killer feature of Go, imho. Also, there is a high level abstraction, github.com/gliderlabs/ssh, which makes it completely trivial to embed an ssh server into an application, giving you a nice way to inspect counters and flip feature flags and tuneables.

Agreed. There's also cool apps you can build with things like https://github.com/charmbracelet/wish

Re: Show HN: I made an SSH tunnel manager to learn Go

#64
post #29

Earlier quoted context omitted.

XDG = X (pronounced “cross”) Desktop Group, aka freedesktop.org, promulgator of conventions for desktop apps. So, neither one really.

Yeah, I'm gonna stick with POSIX. All systems I'm aware of (other than Linux Desktop apps) use $HOME. If you want to extend your functionality to use an OS-specific directory, that's fine, but $HOME is the safest default. (Same for things like $TMPDIR)

None of that is defined in POSIX, hence the perceived need for XDG.

Re: Show HN: I made an SSH tunnel manager to learn Go

#65

After having spent the last year writing rust, it's a breath of fresh air to clone and read through a concise and straightforward repo like this.

As someone who jumps between Go, Rust and Scala - Go is by far the worst.

Antiquated and verbose error handling model. The reliance on code generation because of the lack of a decent type system. The fact you have to carefully read through every function because it's not immutable by default, has pointer arguments and no functional operations e.g. filter.

It's a language that belongs back in the 1990s.

Re: Show HN: I made an SSH tunnel manager to learn Go

#66

After having spent the last year writing rust, it's a breath of fresh air to clone and read through a concise and straightforward repo like this.

Is Rust still that hard to grok even after a year to you? This is by no means meant to be disrespectful but I'm itching to start learning Rust but having only worked in Python/C#/Go I'm getting cold feet just looking at a Rust codebase Disclaimer: I'm usually very good at hitting the ground running, but I am just as much bad at "keeping the pace", i.e. diving deep into stuff

For me it's not the language concepts that are hard, it's that things are sometimes very different and if you come from other languages it's easy to make wrong assumptions.

One resource I would highly recommend after the basic stuff people always recommend is a book called "Learn Rust With Entirely Too Many Linked Lists".

Re: Show HN: I made an SSH tunnel manager to learn Go

#67
If you don't mind a few small advices: don't use global variables that you mutate, prefer structs with methods. Add a main context with signal.NotifyContext to globally handle sigkill/sigterm and have a gracefull shutdown. Also use DialContext when available instead of Dial. You could use errGroup to handle multiple goroutines that return errors (rather than iterating on a channel).

Otherwise it looks good, great job !

Re: Show HN: I made an SSH tunnel manager to learn Go

#68

If you don't mind a few small advices: don't use global variables that you mutate, prefer structs with methods. Add a main context with signal.NotifyContext to globally handle sigkill/sigterm and have a gracefull shutdown. Also use DialContext when available instead of Dial. You could use errGroup to handle multiple goroutines that return errors (rather than iterating on a channel). Otherwise it looks good, great job…

Great, thanks for the advice!

Re: Show HN: I made an SSH tunnel manager to learn Go

#69
post #63

So what do you think of Go after the project? What language(s) did you come from?

IMO, it hits a nice sweet spot between performance and level of abstraction, especially w.r.t. concurrency and networking. Also I found that you get things done incredibly fast. I am mostly doing Python and some C, so Go feels like "somewhere in between".

Re: Show HN: I made an SSH tunnel manager to learn Go

#70
post #39
post #17

Well done. The ease of use and high quality of the Go SSH libraries (golang.org/x/crypto/ssh) is a killer feature of Go, imho. Also, there is a high level abstraction, github.com/gliderlabs/ssh, which makes it completely trivial to embed an ssh server into an application, giving you a nice way to inspect counters and flip feature flags and tuneables.

How is performance? We found the native Go SSL libraries (as used in, e.g. the http package natively) to add many ms to web api calls. We eventually substituted OpenSSL (despite not really wanting to). It significantly sped up the app. YMMV, this is for ARM 32-bit targets.

It is pretty good. Most of the CPU is spent on crypto, which is what you'd expect. The overhead is low enough that I've had no problems having rather meager machines handling thousands of concurrent connections.

If you're having performance issues with TLS I would look at what sort of crypto you're using. At least for SSH, RSA is dog slow. It wouldn't surprise me if you can irk out quite a bit of performance by switching to ed25519.

Post reply on HN