wzshiming / bridge

Bridge is a multi-level proxy that supports clients and servers with multiple protocols. SSHProxy, HTTPProxy, Socks4, Socks5, Shadowsocks.
MIT License
158 stars 15 forks source link

Multiple proxy fails "first path segment in URL cannot contain colon" #13

Open avid0 opened 3 months ago

avid0 commented 3 months ago

When i am using single proxy its work perfectly

bridge -b :123 -p tcp://127.0.0.1:2080

but with multiple tcp proxy

 bridge -b :123 -p tcp://127.0.0.1:2080 -p tcp://127.0.0.1:2070
2024/03/15 21:28:28 INFO DIAL "tcp://127.0.0.1:2080" <- "tcp://127.0.0.1:2070" <- LOCAL <-
 "tcp://:123" LISTEN
 chains="{Bind:[{Probe: LB:[:123]}] Proxy:[{Probe: LB:[tcp://127.0.0.1:2080]} {Probe: LB:[
tcp://127.0.0.1:2070]}] IdleTimeout:0s}"
2024/03/15 21:28:28 ERROR BridgeWithConfig chains="{Bind:[{Probe: LB:[:123]}] Proxy:[{Prob
e: LB:[tcp://127.0.0.1:2080]} {Probe: LB:[tcp://127.0.0.1:2070]}] IdleTimeout:0s}" err="la
st scheme \"tcp\" not supported: invalid scheme"

or multiple socks5 proxy

bridge -b :123 -p socks://127.0.0.1:2080 -p socks5://127.0.0.1:2070
2024/03/15 21:29:41 INFO DIAL "socks://127.0.0.1:2080" <- "socks5://127.0.0.1:2070" <- LOC
AL <- "tcp://:123" LISTEN
 chains="{Bind:[{Probe: LB:[:123]}] Proxy:[{Probe: LB:[socks://127.0.0.1:2080]} {Probe: LB
:[socks5://127.0.0.1:2070]}] IdleTimeout:0s}"
2024/03/15 21:29:41 INFO Connect chains="{Bind:[{Probe: LB:[:123]}] Proxy:[{Probe: LB:[soc
ks://127.0.0.1:2080]} {Probe: LB:[socks5://127.0.0.1:2070]}] IdleTimeout:0s}" remote_addre
ss=127.0.0.1:26402
2024/03/15 21:29:41 ERROR Step chains="{Bind:[{Probe: LB:[:123]}] Proxy:[{Probe: LB:[socks
://127.0.0.1:2080]} {Probe: LB:[socks5://127.0.0.1:2070]}] IdleTimeout:0s}" err="unsupport
ed network \"socks\""
...

without proxy schema (tcp):

bridge -b :123 -p 127.0.0.1:2080 -p 127.0.0.1:2070
2024/03/15 21:30:52 INFO DIAL "tcp://127.0.0.1:2080" <- "tcp://127.0.0.1:2070" <- LOCAL <-
 "tcp://:123" LISTEN
 chains="{Bind:[{Probe: LB:[:123]}] Proxy:[{Probe: LB:[127.0.0.1:2080]} {Probe: LB:[127.0.
0.1:2070]}] IdleTimeout:0s}"
2024/03/15 21:30:52 ERROR BridgeWithConfig chains="{Bind:[{Probe: LB:[:123]}] Proxy:[{Prob
e: LB:[127.0.0.1:2080]} {Probe: LB:[127.0.0.1:2070]}] IdleTimeout:0s}" err="parse \"127.0.
0.1:2070\": first path segment in URL cannot contain colon"

Am i wrong with commands? (using windows 386 bin)

wzshiming commented 3 months ago

Not sure exactly what you're trying to do, but from your description, the 127.0.0.1:2080 is the target, and the 127.0.0.1:2070 is a proxy.

Listening the port 132, forwarded to 127.0.0.1:2080 through socks5://127.0.0.1:2070 proxy

bridge -b :123 -p 127.0.0.1:2080 -p socks5://127.0.0.1:2070