I\'m trying to create (and later close) a simple TCP port forward over SSH with Go. I\'m new to Golang and statically typed languages. (Coming from Ruby.)
In a termi
I'v finished a simple SSH port forward tool called mallory.
It provides HTTP proxy instead of SOCKS proxy, which is really similar to ssh -D.
The core code is similar to damick's answer.
ssh.Dial to remote SSH server with the config and return ClientClient.Dial to forward anything you like.
Dial initiates a connection to the addr from the remote host. The resulting connection has a zero LocalAddr() and RemoteAddr().
Client.Dial to connect to the remote server.