Nytro Posted January 27, 2015 Report Posted January 27, 2015 Run SSH and HTTP(S) on the same portSwitcherSwitcher is a proxy server which accepts connections and proxies based on which protocol is detected.Currently implemented is:SSHThe use case is running HTTP(S) and SSH on the same port.UsageDownload release or Build:makeTo get help:$ ./switcher --helpSwitcher 1.0.0usage: switcher [options]Options: --listen <:80> Server Listen Address --ssh <127.0.0.1:22> SSH Server Address --default <127.0.0.1:8080> Default Server AddressExamples: To serve SSH(127.0.0.1:22) and HTTP(127.0.0.1:8080) on port 80 $ switcher To serve SSH(127.0.0.1:2222) and HTTPS(127.0.0.1:443) on port 443 $ switcher --listen :443 --ssh 127.0.0.1:2222 --default 127.0.0.1:443ExampleRun switcher on HTTP port 80, proxy to SSH on 127.0.0.1:22 and Nginx on 127.0.0.1:8080$ switcher --listen :80 --ssh 127.0.0.1:22 --default 127.0.0.1:8080To test HTTP:$ curl -I http://my-server.localHTTP/1.1 200 OKTo test SSH$ ssh james@my-server.local -p 80Password:Why not sslhSwitcher is heavily influenced by sslh. It started out as a learning exercise to discover how sslh worked and attempt an implementation in Go.The result is useful in its own right through use of Go's interfaces for protocol matching (making adding new protocols trivial), and lightweight goroutines (instead of forking, which is more CPU intensive under load).License3-Clause "Modified" BSD Licence.LicenseSursa: https://github.com/jamescun/switcher Quote