heiher / hev-socks5-tunnel

A high-performance tun2socks for Linux/Android/FreeBSD/macOS/iOS/WSL2 (IPv4/IPv6/TCP/UDP)
MIT License
636 stars 130 forks source link

请问怎么实现自定义绕过 ip #88

Closed Cyberbolt closed 4 months ago

Cyberbolt commented 4 months ago

请问如何实现路由规则的匹配?如中国大陆内 ip 走直连,大陆外走 socks。只有自己设置路由表来实现吗?如果 ip 数量有数以百万计,会对 tun2socks 的性能产生影响吗?谢谢!

heiher commented 4 months ago

一般是通过策略路由实现,比如给特定的IPSet配置fwmark,然后在路由规则上按不同的fwmark值走不同的路由规则。

Cyberbolt commented 4 months ago

谢谢!开发自己的客户端,我需要动态设置这个代理规则,在 Linux 和 macOS 可以通过 iptables 实现,在 Windows 上又怎么做呢?如果是安卓和 iOS 呢

heiher commented 4 months ago

当前不支持Windows。其它平台如果不支持复杂的路由策略,可以考虑实现为Socks5服务端侧分流。

heiher commented 3 months ago

https://github.com/heiher/hev-socks5-tunnel#freebsdmacos