xjasonlyu / tun2socks

tun2socks - powered by gVisor TCP/IP stack
https://github.com/xjasonlyu/tun2socks/wiki
GNU General Public License v3.0
2.86k stars 407 forks source link

Forward TCP and UDP separately #45

Closed hdid closed 3 years ago

hdid commented 3 years ago

Hi Is it possible that forward TCP traffic to for example socks1:1080 and UDP to socks2:1081? Because some proxies do not support udp but have good speed for tcp forwarding. Thanks

xjasonlyu commented 3 years ago

Maybe you can use iptables to redirect separately.

hdid commented 3 years ago

I tried some tips but failed: https://serverfault.com/questions/234370/forward-all-ports-incoming-to-a-specific-ip-to-internal-ip-address https://serverfault.com/questions/690435/iptables-udp-port-forwarding

xjasonlyu commented 3 years ago

It seems like you need the OUTPUT chain.

hdid commented 3 years ago

Ohhh, I'm really confused. Could you please give me some sample commands?

xjasonlyu commented 3 years ago

https://unix.stackexchange.com/questions/85932/how-can-i-redirect-outbound-traffic-to-port-80-using-iptables-locally

I'm not sure if this would work.

hdid commented 3 years ago

Yeah did not work.

xjasonlyu commented 3 years ago

Technically, it’s not tun2socks’ job to do that, but proxy server’s. Maybe you just get your needs wrong at the first time.

hdid commented 3 years ago

Thanks for replies. I mostly liked this mode become an optional feature of tun2socks; arguments like -tcp-proxy and -udp-proxy that should be used together.. Thank you anyway ;)

github-actions[bot] commented 3 years ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days

tormentous commented 2 years ago

this is exactly what UDPGW is