Tomato-ARM部署ShadowSocks科学上网(3)
- UID
- 1029342
- 性别
- 男
|
Tomato-ARM部署ShadowSocks科学上网(3)
068 | sed -n '1,15p' /jffs/ignore.list > /jffs/lan.list |
070 | ipset -F ss_spec_wan_ac &> /dev/null |
071 | ipset -F ss_spec_lan_ac &> /dev/null |
072 | sed -e "s/^/-A ss_spec_wan_ac &/g" -e "1 i\-N ss_spec_wan_ac hash:net " $LAN | ipset -R -! |
077 | iptables -t nat -D PREROUTING -p tcp -m multiport --dports 22,80,443 -m set ! --match-set ss_spec_lan_ac src -j SS_SPEC_WAN_AC &> /dev/null |
078 | iptables -t nat -F SS_SPEC_WAN_AC &> /dev/null |
079 | iptables -t nat -F SS_SPEC_WAN_FW &> /dev/null |
080 | iptables -t nat -D OUTPUT -p tcp -m multiport --dports 22,80,443 -j SS_SPEC_WAN_AC &> /dev/null |
082 | iptables -t nat -X SS_SPEC_WAN_AC &> /dev/null |
083 | iptables -t nat -X SS_SPEC_WAN_FW &> /dev/null |
084 | ipset destroy ss_spec_wan_ac &> /dev/null |
085 | ipset destroy ss_spec_lan_ac &> /dev/null |
089 | if [ -f "/jffs/ignore.list" ] |
091 | rm -f /jffs/ignore.list |
094 | touch /jffs/ignore.list |
097 | # Path to save you rule file |
098 | RULE_FILE=/jffs/ignore_tmp.txt |
099 | LINE=/jffs/ignore.list |
118 | for each_line in $EX_DOMAIN |
120 | echo $each_line >> $LINE |
125 | /opt/etc/init.d/S24chinadns restart |
127 | cat $RULE_FILE >> $LINE |
128 | rm -f /jffs/ignore_tmp.txt |
130 | /jffs/shadowsocks flush |
132 | /jffs/shadowsocks ipset |
133 | /jffs/shadowsocks rules |
137 | cat /etc/resolv.dnsmasq | awk '/^nameserver/{print $2}' > /jffs/dns.list |
138 | DNS=`sed -n '1p' /jffs/dns.list` |
140 | sed -i "s|^\(server.*\)/[^/]*$|\1/$DNS|" /jffs/dnsmasq.d/chinalist.conf |
142 | service dnsmasq restart |
146 | LOGTIME=$(date "+%Y-%m-%d %H:%M:%S") |
148 | if [ "$?" == "0" ]; then |
149 | echo '['$LOGTIME'] No problem, the normal operation of shadowsoks.' >> /var/log/shadowsocks_watchdog.log 2>&1 |
151 | echo '['$LOGTIME'] Shadowsoks abnormal operation, restarting shadowsocks.' >> /var/log/shadowsocks_watchdog.log 2>&1 |
152 | /opt/etc/init.d/S22shadowsocks restart |
153 | /opt/etc/init.d/S24chinadns restart |
159 | echo "Usage : $0 {set_up|run|ipset|rules|global|flush|update|update_chinalist|check}" |
168 | echo " $0 update_chinalist" |
170 | echo " [set_up] Set ShadowSocks and ChinaDNS" |
171 | echo " [run] Running shadowsocks and ChinaDNS" |
172 | echo " [ipset] Loading module and ipset rule" |
173 | echo " [rules] Application Firewall Policy" |
174 | echo " [global] Global Proxy" |
175 | echo " [flush] Clear firewall policy" |
176 | echo " [update] Update China routing table" |
177 | echo " [update_chinalist] Update Chinese domain name" |
178 | echo " [check] Guardian ss-redir" |
|
|
|
|
|
|