Socks和HTTP代理的隧道(TUN)接口内网穿透
HTTP代理支持(未经身份验证、基本身份验证和摘要身份验证)
SOCKS4和SOCKS5支持(未经身份验证,用户名密码身份验证)
SOCKS4a和SOCKS5h支持(通过虚拟DNS功能)
路由所有流量的最小配置设置
IPv4和IPv6支持
某些用例的GFW规避机制
SOCKS5 UDP支持
本机支持通过TCP代理DNS
如何构建源码?
cargo build --release
./build-apple.sh
1,二进制安装,直接从releases下载,然后配置PATH路径即可。
2,从源码构建,cargo install tun2proxy。
1,自动配置
sudo ./target/release/tun2proxy --setup --proxy "socks5://1.2.3.4:1080"
2,手动配置
# The proxy type can be either SOCKS4, SOCKS5 or HTTP.PROXY_TYPE=SOCKS5PROXY_IP=1.2.3.4PROXY_PORT=1080BYPASS_IP=123.45.67.89# Create a tunnel interface named tun0 which you can bind to,# so we don't need to run tun2proxy as root.sudo ip tuntap add name tun0 mode tunsudo ip link set tun0 up# To prevent a routing loop, we add a route to the proxy server that behaves# like the default route.sudo ip route add "$BYPASS_IP" $(ip route | grep '^default' | cut -d ' ' -f 2-)# Route all your traffic through tun0 without interfering with the default route.sudo ip route add 128.0.0.0/1 dev tun0sudo ip route add 0.0.0.0/1 dev tun0# If you wish to also route IPv6 traffic through the proxy, these two commands will do.sudo ip route add ::/1 dev tun0sudo ip route add 8000::/1 dev tun0# Make sure that DNS queries are routed through the tunnel.sudo sh -c "echo nameserver 198.18.0.1 > /etc/resolv.conf"./target/release/tun2proxy --tun tun0 --proxy "$PROXY_TYPE://$PROXY_IP:$PROXY_PORT"sudo ip link del tun0