Created
December 24, 2014 11:43
-
-
Save aa65535/0354bef0c7b57d90a72a to your computer and use it in GitHub Desktop.
SHADOWSOCKS DNAT
This file contains 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
iptab_r() { | |
local LOCAL_IP BODY | |
LOCAL_IP=$(uci get network.lan.ipaddr 2>/dev/null) | |
BODY=$(echo -e "$IPLIST" | \ | |
awk '$1 ~ /^([0-9]{1,3}\.){3}[0-9]{1,3}/ \ | |
{printf("-A SHADOWSOCKS -d %s -j RETURN\n", $1)}') | |
iptables-restore -n <<-EOF | |
*nat | |
:SHADOWSOCKS - [0:0] | |
$BODY | |
-A SHADOWSOCKS -p tcp $EXT_ARGS -j DNAT --to-destination $LOCAL_IP:$LOCAL_PORT | |
-A PREROUTING -p tcp -j SHADOWSOCKS | |
COMMIT | |
EOF | |
exit $? | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment