Last active
July 23, 2018 14:21
-
-
Save everyx/9123cf2f4175355c90fd to your computer and use it in GitHub Desktop.
使用 bestroutetb 生成为 shadowsocks 透明代理需要的 shell 脚本
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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