Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@everyx
Last active July 23, 2018 14:21
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save everyx/9123cf2f4175355c90fd to your computer and use it in GitHub Desktop.
Save everyx/9123cf2f4175355c90fd 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