Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save swors/9f6f89ab559f0b9da12b68c282adb7fe to your computer and use it in GitHub Desktop.
Save swors/9f6f89ab559f0b9da12b68c282adb7fe to your computer and use it in GitHub Desktop.
使用 bestroutetb 生成为 shadowsocks 透明代理需要的 shell 脚本
#!/usr/bin/bash
filename=$'iptables.shadow'
bestroutetb -p custom -o $filename --rule-format=$'iptables -t nat -A SHADOWSOCKS -d %prefix/%mask -j %gw\n' --gateway.net=RETURN --gateway.vpn=ACCEPT --header=$'#!/usr/bin/sh\niptables -t nat -A SHADOWSOCKS -p tcp -j REDIRECT --to-ports 1080\niptables -t nat -A SHADOWSOCKS -d MY_SS-REDIR_SERVER_IP -j RETURN\n\n' --footer=$'\niptables -t nat -A SHADOWSOCKS -p tcp -j REDIRECT --to-ports 1080\niptables -t nat -A PREROUTING -p tcp -j SHADOWSOCKS\n'
if [ -f "$filename" ]; then
sed -e '/-j ACCEPT/d' $filename > tmp
rm $filename
mv tmp $filename
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment