Show HN: Socks Protocol Version 5 Library in Go
github.com
github.com
Seriously though, such "boring" libraries that you just need in your toolbox are a great way to evaluate the health of the whole ecosystem.
Last time was I needed to tunnel a request from my development environment into a production VPN to contact a service which had IP access restrictions.
There might have been another way to do it, but given that wrapping HTTP in a SOCKS proxy is easy and ssh has a built in SOCKS proxy, this was quick win.
ps. It's SOCKS and not Socks - for the subject line of this story.
if you point firefox to use a remote ssh host as socks proxy then you can browse internet as if you were in the ssh host subnet.
it's basically a poor man's vpn, but if all you do is www browsing it works perfectly.
ssh -D 8000 -q -C -N user@sshhost
point firefox to use localhost:8000 as socksproxy, and all your internet traffic appears to have originate from sshhost. ssh -L 60001:host2:22 -N user1@host1 &
ssh -L 60002:host3:22 -p 60001 -N user2@localhost &
ssh -D 8000 -p 60002 -N user3@localhost &1) That's what the ProxyCommand config option is for. Most systems will have netcat or nc installed which do provide SOCKS client support
2) Or just use the -J option argument, which IIRC was originally implemented as a transformation to -oProxyCommand='ssh ... [netcat/nc]' but now is a simple transformation to the newer -W option argument, which doesn't depend on netcat/nc being installed on the intermediate host.
You can apparently set the firefox flag "network.proxy.socks_remote_dns"
Never tried it myself!
Now, perhaps firefox does not need to do a lookup; it sends the hostname to the remote end.
But best be safe?