SSH tunneling in Golang
In my previous post, I illustrated the basic usage of ssh package. In this article I will demonstrate how we should use it to implement SSH tunneling. We will forward connection to localhost:9000 through example.com:22 to localhost:8080. The tunneling protocol allows a network user to access or provide a network service that the underlying network does not support or provide directly. We have four actors in this scenario: client - the client that needs resource from remote server local server - a server accessible by the client intermediate server - a server accessible by the local server and remote/target server remote/target server - a server running behind the intermediate server network Each of this server endpoints can be represented by the following struct:...