Forwarding a Port Over SSH in Go
In the day and age where Kubernetes is the go-to tool for orchestrating your applications on the cloud, I have been spending time building Bullet. I enjoy working on this tool, building out features for it little by little. And it also allows me to learn so many details.
For example I just added the ability to forward ports from the remote server to the local over SSH. Bullet, being built using Go, I had to figure out how to forward a port over SSH in Go.
In the command line world, you would use the -L
flag that the ssh
command provides for something like this.
In Go, you need to do a bit more:
|
|
You can use this function like so:
|
|
And access it:
curl https://localhost:8080
This post is 94th of my #100DaysToOffload challenge. Want to get involved? Find out more at 100daystooffload.com.
comments powered by Disqus