shadowsocks / shadowsocks-rust

A Rust port of shadowsocks
https://shadowsocks.org/
MIT License
8.06k stars 1.12k forks source link

Feature Request: Chain Shadowsocks #904

Open PowerPress opened 1 year ago

PowerPress commented 1 year ago

Is your feature request related to a problem? Please describe. I would like to create a chain of shadowsocks servers like proxychains client - ss server - ss server - ss server - ss server -target

Describe the solution you'd like Have a chain option in shadowsocks

zonyitoo commented 1 year ago

You can do this with a tunnel:

sslocal(real) -> [sslocal(tunnel) -> ssserver] -> [sslocal(tunnel) -> ssserver] -> ssserver(real)
PowerPress commented 1 year ago

Could you give me an example of commands to do this?

zonyitoo commented 1 year ago

Let's say if you have a server running on 100.100.100.200:1234, and there is a server in the middle listening on 100.100.100.101:2345, then:

Local server:

sslocal -b '127.0.0.1:1080' -s '100.100.100.101:2345' -m 'aes-128-gcm' -k 'TARGET_SERVER_PWD'

Middle server:

# Start a sslocal with tunnel protocol, forwarding all data to 100.100.100.200:1234
sslocal -b '100.100.100.101:2345' --protocol tunnel -s '127.0.0.1:8888' -m 'plain' -k '' --forward-addr '100.100.100.200:1234'

# Start a ssserver locally
ssserver -b '127.0.0.1:8888' -m 'plain' -k ''

Target server:

ssserver -s '100.100.100.200:1234' -m 'aes-128-gcm' -k 'TARGET_SERVER_PWD'

BUT. This is slow, because all the middle servers must run both sslocal and ssserver. Actually you can simply make a dummy TCP, UDP tunnel proxy server with any languages you want:

sslocal -> [Tunnel Proxy server 1] -> [Tunnel Proxy server 2] -> ssserver

Some possible choices:

  1. v2ray-plugin, running in standalone mode
  2. https://github.com/Qv2ray/mmp-go