ssh tunnel forwarding library for Go. Implemented using golang.org/x/crypto/ssh . Like linux command:
ssh -N -f -L 3307:remoteHost:3306 sshUsername@sshHostname
go get -u github.com/alwaysthanks/sshTunnel
sshTool, err := NewSSHTool(sshHostname, sshUsername, sshPassword, "")
if err != nil {
}
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
proxyServer, err := NewTunnelServer(ctx, localAddr, remoteAddr, sshTool)
if err != nil {
}
//run ssh proxy
go proxyServer.Start()
//begin your service
sshTool, err := NewSSHTool(sshHostname, sshUsername, sshPassword, "")
if err != nil {
}
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
//here use ssh pool
proxyServer, err := NewTunnelServerWithPool(ctx, localAddr, remoteAddr, sshTool)
if err != nil {
}
//run ssh proxy
go proxyServer.Start()
//begin your service
View the LICENSE file