wssocks icon indicating copy to clipboard operation
wssocks copied to clipboard

Feature Request: Permit reverse proxy

Open chrisjd20 opened this issue 2 years ago • 2 comments

So this is a great program. But what I would love is a reverse socks tunnel feature. So that you could have a client connect to a server and bind a local port on the server to listen and tunnel into the client's network. This is great if you have a client that doesnt have a public IP but you need to be able to reach into it's network. This is equivalent to ssh's -R option:

ssh -R 9050 [email protected]

chrisjd20 avatar Sep 16 '21 15:09 chrisjd20

Currently, wssocks indeed does not support reverse proxy directly.
But wssocks+ssh can be a workaround.
Consider you have a web service on the client (at port :9050), and server has a public IP (e.g. pub.server.com).

In traditional approach, if client can connect to server via ssh directly, we can use ssh -R, just like:

client_host$ ssh -NR pub.server.com:9051:localhost:9050 [email protected]

Then, we can access client's web service via curl http://pub.server.com:9051/.

If client can not connect to server via ssh directly (but can connect using wssocks), then the ssh reverse proxy can be changed to:

client_host$ ssh -o ProxyCommand='nc -x 127.0.0.1:1080 %h %p' -NR pub.server.com:9051:localhost:9050 [email protected]

(where port :1080 above is wssocks client's port for data forwarding)

May this workaround can help you.

Native reverse proxy support of wssocks can be a really useful feature, I would consider to implement it.

genshen avatar Sep 16 '21 16:09 genshen

Thats definitely a possible work around but not on Windows system with specific restrictions.

chrisjd20 avatar Sep 16 '21 16:09 chrisjd20