omrikiei / ktunnel

A cli that exposes your local resources to kubernetes
GNU General Public License v3.0
974 stars 75 forks source link

Allow forwarding to more than just `localhost` from the client but any host visible from the client? #108

Closed nelsonjchen closed 1 year ago

nelsonjchen commented 1 year ago

https://github.com/omrikiei/ktunnel/blob/c7a64e73adf5344c3698273be458902ee5d8d5d4/pkg/client/client.go#L48-L72

It's currently hardcoded to localhost in client. What if I want to forward it to remote_host that's visible from where my client is? I currently have to work in socat with socat TCP-LISTEN:8080,fork,reuseaddr TCP:remote_host:8080. It'll be nice to skip that step. That also complicates setting up a few forwarding services as since it's hardcoded to localhost, you need to make sure the ports don't collide.

A similar thing would be this SSH reverse tunneling example:

ssh -N -R 8080:remote_host:8080 user@machineA_IP_address

I'm curious if a PR to implement this would be accepted or if there's some other blocking concern. Would a PR be taken?

omrikiei commented 1 year ago

I like that! great idea, would be happily accepted