luci-app-ssr-plus: sync with Lean's source
This commit is contained in:
parent
ded992b0f9
commit
16039f71b6
@ -1,8 +1,8 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-ssr-plus
|
||||
PKG_VERSION:=168
|
||||
PKG_RELEASE:=2
|
||||
PKG_VERSION:=169
|
||||
PKG_RELEASE:=6
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
|
||||
|
||||
@ -48,7 +48,7 @@ define Package/$(PKG_NAME)
|
||||
SUBMENU:=3. Applications
|
||||
TITLE:=SS/SSR/V2Ray/Trojan LuCI interface
|
||||
PKGARCH:=all
|
||||
DEPENDS:=+shadowsocksr-libev-alt +ipset +ip-full +iptables-mod-tproxy +dnsmasq-full +coreutils +coreutils-base64 +pdnsd-alt +wget +lua \
|
||||
DEPENDS:=+shadowsocksr-libev-alt +ipset +ip-full +iptables-mod-tproxy +dnsmasq-full +coreutils +coreutils-base64 +pdnsd-alt +wget +lua +libuci-lua \
|
||||
+microsocks +ipt2socks +dns2socks +shadowsocks-libev-ss-local +shadowsocksr-libev-ssr-local \
|
||||
+PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks:shadowsocks-libev-ss-redir \
|
||||
+PACKAGE_$(PKG_NAME)_INCLUDE_Simple_obfs:simple-obfs \
|
||||
@ -56,9 +56,8 @@ define Package/$(PKG_NAME)
|
||||
+PACKAGE_$(PKG_NAME)_INCLUDE_V2ray:v2ray \
|
||||
+PACKAGE_$(PKG_NAME)_INCLUDE_Trojan:trojan \
|
||||
+PACKAGE_$(PKG_NAME)_INCLUDE_Redsocks2:redsocks2 \
|
||||
+PACKAGE_$(PKG_NAME)_INCLUDE_Kcptun:openwrt-kcptun-client \
|
||||
+PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR_Server:shadowsocksr-libev-server \
|
||||
+PACKAGE_$(PKG_NAME)_INCLUDE_DNS2SOCKS:dns2socks
|
||||
+PACKAGE_$(PKG_NAME)_INCLUDE_Kcptun:kcptun-client \
|
||||
+PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR_Server:shadowsocksr-libev-server
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
@ -114,7 +113,7 @@ define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DATA) ./luasrc/view/shadowsocksr/* $(1)/usr/lib/lua/luci/view/shadowsocksr/
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/i18n
|
||||
po2lmo ./po/zh_Hans/ssr-plus.po $(1)/usr/lib/lua/luci/i18n/ssr-plus.zh-cn.lmo
|
||||
po2lmo ./po/zh-cn/ssr-plus.po $(1)/usr/lib/lua/luci/i18n/ssr-plus.zh-cn.lmo
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/postinst
|
||||
|
||||
@ -46,7 +46,7 @@ for _,key in pairs(key_table) do o:value(key,server_table[key]) end
|
||||
o = s:option(ListValue, "netflix_server", translate("Netflix Node"))
|
||||
o:value("same", translate("Same as Global Server"))
|
||||
for _,key in pairs(key_table) do o:value(key,server_table[key]) end
|
||||
o.default = "nil"
|
||||
o.default = "same"
|
||||
o.rmempty = false
|
||||
|
||||
o = s:option(ListValue, "threads", translate("Multi Threads Option"))
|
||||
@ -76,11 +76,8 @@ o.default = 1
|
||||
|
||||
o = s:option(ListValue, "pdnsd_enable", translate("Resolve Dns Mode"))
|
||||
o:value("1", translate("Use Pdnsd tcp query and cache"))
|
||||
if nixio.fs.access("/usr/bin/dns2socks") then
|
||||
o:value("2", translate("Use DNS2SOCKS query and cache"))
|
||||
end
|
||||
o:value("0", translate("Use Local DNS Service listen port 5335"))
|
||||
o:value("2", translate("Use system DNS"))
|
||||
o.default = 1
|
||||
|
||||
o = s:option(Value, "tunnel_forward", translate("Anti-pollution DNS Server"))
|
||||
|
||||
@ -118,4 +118,21 @@ o.remove = function(self, section, value)
|
||||
NXFS.writefile(netflixconf, "")
|
||||
end
|
||||
|
||||
s:tab("netflixip", translate("Netflix IP List"))
|
||||
|
||||
local netflixipconf = "/etc/config/netflixip.list"
|
||||
o = s:taboption("netflixip", TextValue, "netflixipconf")
|
||||
o.rows = 13
|
||||
o.wrap = "off"
|
||||
o.rmempty = true
|
||||
o.cfgvalue = function(self, section)
|
||||
return NXFS.readfile(netflixipconf) or " "
|
||||
end
|
||||
o.write = function(self, section, value)
|
||||
NXFS.writefile(netflixipconf, value:gsub("\r\n", "\n"))
|
||||
end
|
||||
o.remove = function(self, section, value)
|
||||
NXFS.writefile(netflixipconf, "")
|
||||
end
|
||||
|
||||
return m
|
||||
|
||||
@ -476,7 +476,7 @@ msgid "Please refer to the following writing"
|
||||
msgstr "每行一个域名,无需写前面的 HTTP(S):// ,提交后即时生效"
|
||||
|
||||
msgid "Servers subscription and manage"
|
||||
msgstr "服务器节点订阅与管理(支持订阅和手动导入SSR链接)"
|
||||
msgstr "服务器节点订阅与管理"
|
||||
|
||||
msgid "Through proxy update list, Not Recommended"
|
||||
msgstr "通过路由器自身代理更新订阅"
|
||||
@ -517,9 +517,6 @@ msgstr "服务器节点"
|
||||
msgid "Use Local DNS Service listen port 5335"
|
||||
msgstr "使用本机端口为5335的DNS服务"
|
||||
|
||||
msgid "Use system DNS"
|
||||
msgstr "使用系统DNS"
|
||||
|
||||
msgid "Server Node Type"
|
||||
msgstr "服务器节点类型"
|
||||
|
||||
@ -648,3 +645,6 @@ msgstr "Netflix 分流服务器"
|
||||
|
||||
msgid "Netflix Domain List"
|
||||
msgstr "Netflix 分流域名列表"
|
||||
|
||||
msgid "Netflix IP List"
|
||||
msgstr "Netflix 分流IP列表"
|
||||
|
||||
@ -0,0 +1,15 @@
|
||||
8.41.4.0/24
|
||||
23.246.0.0/18
|
||||
37.77.184.0/21
|
||||
45.57.0.0/17
|
||||
64.120.128.0/17
|
||||
66.197.128.0/17
|
||||
69.53.224.0/19
|
||||
108.175.32.0/20
|
||||
185.2.220.0/22
|
||||
185.9.188.0/22
|
||||
192.173.64.0/18
|
||||
198.38.96.0/19
|
||||
198.45.48.0/20
|
||||
207.45.72.0/22
|
||||
208.75.76.0/22
|
||||
@ -108,11 +108,15 @@ gen_config_file() {
|
||||
}
|
||||
EOF
|
||||
local plugin=$(uci_get_by_name $1 plugin)
|
||||
if [ -n "$plugin" ] && [ "$plugin" == "simple-obfs" ]; then
|
||||
plugin="obfs-local"
|
||||
fi
|
||||
if [ -n "$plugin" -a -x "/usr/bin/$plugin" ]; then
|
||||
sed -i "s@$hostip\",@$hostip\",\n\"plugin\": \"$plugin\",\n\"plugin_opts\": \"$(uci_get_by_name $1 plugin_opts)\",@" $config_file
|
||||
if [ -n "$plugin" ]; then
|
||||
if [ "$plugin" == "simple-obfs" ]; then
|
||||
plugin="obfs-local"
|
||||
fi
|
||||
if [ -x "/usr/bin/$plugin" ]; then
|
||||
sed -i "s@$hostip\",@$hostip\",\n\"plugin\": \"$plugin\",\n\"plugin_opts\": \"$(uci_get_by_name $1 plugin_opts)\",@" $config_file
|
||||
else
|
||||
echo "$(date "+%Y-%m-%d %H:%M:%S") Warning!!! SIP003 plugin $plugin not found!!!" >>/tmp/ssrplus.log
|
||||
fi
|
||||
fi
|
||||
elif [ "$stype" == "ssr" ]; then
|
||||
cat <<-EOF >$config_file
|
||||
@ -202,6 +206,11 @@ start_rules() {
|
||||
else
|
||||
proxyport="-m multiport --dports 22,53,587,465,995,993,143,80,443"
|
||||
fi
|
||||
if [ "$NETFLIX_SERVER" != "same" ]; then
|
||||
netflix="1"
|
||||
else
|
||||
netflix="0"
|
||||
fi
|
||||
/usr/bin/ssr-rules \
|
||||
-s "$server" \
|
||||
-l "$local_port" \
|
||||
@ -215,6 +224,7 @@ start_rules() {
|
||||
-p "$(uci_get_by_type access_control lan_fp_ips)" \
|
||||
-G "$(uci_get_by_type access_control lan_gm_ips)" \
|
||||
-D "$proxyport" \
|
||||
-F "$netflix" \
|
||||
$(get_arg_out) $gfwmode $ARG_UDP
|
||||
return $?
|
||||
}
|
||||
@ -300,28 +310,24 @@ start_redir() {
|
||||
elif [ "$stype" == "tun" ]; then
|
||||
sscmd="/usr/sbin/redsocks2"
|
||||
fi
|
||||
|
||||
NETFLIX_SERVER=$(uci_get_by_type global netflix_server same)
|
||||
[ "$NETFLIX_SERVER" == "same" ] && NETFLIX_SERVER=$GLOBAL_SERVER
|
||||
gen_config_file $NETFLIX_SERVER 2 4321
|
||||
gen_config_file $NETFLIX_SERVER 3 1088
|
||||
local ntype=$(uci_get_by_name $NETFLIX_SERVER type)
|
||||
if [ "$ntype" == "ss" ]; then
|
||||
ncmd="/usr/bin/ss-redir"
|
||||
sssock="/usr/bin/ss-local"
|
||||
elif [ "$ntype" == "ssr" ]; then
|
||||
ncmd="/usr/bin/ssr-redir"
|
||||
sssock="/usr/bin/ssr-local"
|
||||
elif [ "$ntype" == "v2ray" ]; then
|
||||
ncmd="/usr/bin/v2ray/v2ray"
|
||||
[ ! -f "$ncmd" ] && ncmd="/usr/bin/v2ray"
|
||||
elif [ "$ntype" == "trojan" ]; then
|
||||
ncmd="/usr/sbin/trojan"
|
||||
elif [ "$ntype" == "socks5" ]; then
|
||||
ncmd="/usr/sbin/redsocks2"
|
||||
elif [ "$ntype" == "tun" ]; then
|
||||
ncmd="/usr/sbin/redsocks2"
|
||||
fi
|
||||
|
||||
local ntype=$(uci_get_by_name $NETFLIX_SERVER type)
|
||||
if [ "$ntype" == "ss" ]; then
|
||||
ncmd="/usr/bin/ss-redir"
|
||||
sssock="/usr/bin/ss-local"
|
||||
elif [ "$ntype" == "ssr" ]; then
|
||||
ncmd="/usr/bin/ssr-redir"
|
||||
sssock="/usr/bin/ssr-local"
|
||||
elif [ "$ntype" == "v2ray" ]; then
|
||||
ncmd="/usr/bin/v2ray/v2ray"
|
||||
[ ! -f "$ncmd" ] && ncmd="/usr/bin/v2ray"
|
||||
elif [ "$ntype" == "trojan" ]; then
|
||||
ncmd="/usr/sbin/trojan"
|
||||
elif [ "$ntype" == "socks5" ]; then
|
||||
ncmd="/usr/sbin/redsocks2"
|
||||
elif [ "$ntype" == "tun" ]; then
|
||||
ncmd="/usr/sbin/redsocks2"
|
||||
fi
|
||||
|
||||
local utype=$(uci_get_by_name $UDP_RELAY_SERVER type)
|
||||
if [ "$utype" == "ss" ]; then
|
||||
@ -375,16 +381,39 @@ start_redir() {
|
||||
echo "$(date "+%Y-%m-%d %H:%M:%S") Network Tunnel REDIRECT $threads Threads Started!" >>/tmp/ssrplus.log
|
||||
fi
|
||||
|
||||
|
||||
if [ "$ntype" == "ss" -o "$ntype" == "ssr" ]; then
|
||||
$sssock -c /var/etc/shadowsocksr_s.json $ARG_OTA -f /var/run/ssr-socksdns.pid >/dev/null 2>&1
|
||||
dns2socks 127.0.0.1:1088 8.8.8.8:53 127.0.0.1:5555 -q >/dev/null 2>&1 &
|
||||
$ncmd -c /var/etc/shadowsocksr_n.json $ARG_OTA -f /var/run/ssr-netflix.pid >/dev/null 2>&1
|
||||
elif [ "$stype" == "v2ray" ]; then
|
||||
lua /usr/share/shadowsocksr/genv2nfconfig.lua $NETFLIX_SERVER tcp 4321 >/var/etc/v2-ssr-netflix.json
|
||||
$ncmd -config /var/etc/v2-ssr-netflix.json >/dev/null 2>&1 &
|
||||
dns2socks 127.0.0.1:1088 8.8.8.8:53 127.0.0.1:5555 -q >/dev/null 2>&1 &
|
||||
fi
|
||||
if [ "$NETFLIX_SERVER" != "same" ]; then
|
||||
if [ "$ntype" == "ss" -o "$ntype" == "ssr" ]; then
|
||||
gen_config_file $NETFLIX_SERVER 2 4321
|
||||
gen_config_file $NETFLIX_SERVER 3 1088
|
||||
$sssock -c /var/etc/shadowsocksr_s.json $ARG_OTA -f /var/run/ssr-socksdns.pid >/dev/null 2>&1
|
||||
dns2socks 127.0.0.1:1088 8.8.8.8:53 127.0.0.1:5555 -q >/dev/null 2>&1 &
|
||||
$ncmd -c /var/etc/shadowsocksr_n.json $ARG_OTA -f /var/run/ssr-netflix.pid >/dev/null 2>&1
|
||||
elif [ "$ntype" == "v2ray" ]; then
|
||||
lua /usr/share/shadowsocksr/genv2nfconfig.lua $NETFLIX_SERVER tcp 4321 >/var/etc/v2-ssr-netflix.json
|
||||
$ncmd -config /var/etc/v2-ssr-netflix.json >/dev/null 2>&1 &
|
||||
dns2socks 127.0.0.1:1088 8.8.8.8:53 127.0.0.1:5555 -q >/dev/null 2>&1 &
|
||||
elif [ "$ntype" == "trojan" ]; then
|
||||
lua /usr/share/shadowsocksr/gentrojanconfig.lua $NETFLIX_SERVER nat 4321 >/var/etc/trojan-ssr-netflix.json
|
||||
sed -i 's/\\//g' /var/etc/trojan-ssr-netflix.json
|
||||
$ncmd --config /var/etc/trojan-ssr-netflix.json >/dev/null 2>&1 &
|
||||
lua /usr/share/shadowsocksr/gentrojanconfig.lua $NETFLIX_SERVER client 1088 >/var/etc/trojan-ssr-socksdns.json
|
||||
sed -i 's/\\//g' /var/etc/trojan-ssr-socksdns.json
|
||||
$ncmd --config /var/etc/trojan-ssr-socksdns.json >/dev/null 2>&1 &
|
||||
dns2socks 127.0.0.1:1088 8.8.8.8:53 127.0.0.1:5555 -q >/dev/null 2>&1 &
|
||||
elif [ "$ntype" == "socks5" ]; then
|
||||
/usr/share/shadowsocksr/genred2config.sh "/var/etc/redsocks-ssr-netflix.conf" socks5 tcp 4321 \
|
||||
$(uci_get_by_name $NETFLIX_SERVER server) $(uci_get_by_name $NETFLIX_SERVER server_port) \
|
||||
$(uci_get_by_name $NETFLIX_SERVER auth_enable 0) $(uci_get_by_name $NETFLIX_SERVER username) $(uci_get_by_name $NETFLIX_SERVER password)
|
||||
$ncmd -c /var/etc/redsocks-ssr-netflix.conf >/dev/null 2>&1
|
||||
microsocks -i 127.0.0.1 -p 1088 ssr-socksdns >/dev/null 2>&1 &
|
||||
dns2socks 127.0.0.1:1088 8.8.8.8:53 127.0.0.1:5555 -q >/dev/null 2>&1 &
|
||||
elif [ "$ntype" == "tun" ]; then
|
||||
/usr/share/shadowsocksr/genred2config.sh "/var/etc/redsocks-ssr-netflix.conf" vpn $(uci_get_by_name $NETFLIX_SERVER iface "br-lan") 4321
|
||||
$ncmd -c /var/etc/redsocks-ssr-netflix.conf >/dev/null 2>&1
|
||||
microsocks -i 127.0.0.1 -p 1088 ssr-socksdns >/dev/null 2>&1 &
|
||||
dns2socks 127.0.0.1:1088 8.8.8.8:53 127.0.0.1:5555 -q >/dev/null 2>&1 &
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
if [ -n "$UDP_RELAY_SERVER" ]; then
|
||||
@ -408,7 +437,8 @@ start_redir() {
|
||||
$ucmd --config /var/etc/trojan-ssr-reudp.json >/dev/null 2>&1 &
|
||||
ipt2socks -U -b 0.0.0.0 -4 -s 127.0.0.1 -p 10801 -l $(uci_get_by_name $UDP_RELAY_SERVER local_port) >/dev/null 2>&1 &
|
||||
elif [ "$utype" == "socks5" ]; then
|
||||
/usr/share/shadowsocksr/genred2config.sh "/var/etc/redsocks-ssr-reudp.conf" socks5 udp $(uci_get_by_name $UDP_RELAY_SERVER local_port) $(uci_get_by_name $UDP_RELAY_SERVER server) $(uci_get_by_name $UDP_RELAY_SERVER server_port) \
|
||||
/usr/share/shadowsocksr/genred2config.sh "/var/etc/redsocks-ssr-reudp.conf" socks5 udp $(uci_get_by_name $UDP_RELAY_SERVER local_port) \
|
||||
$(uci_get_by_name $UDP_RELAY_SERVER server) $(uci_get_by_name $UDP_RELAY_SERVER server_port) \
|
||||
$(uci_get_by_name $UDP_RELAY_SERVER auth_enable 0) $(uci_get_by_name $UDP_RELAY_SERVER username) $(uci_get_by_name $UDP_RELAY_SERVER password)
|
||||
$ucmd -c /var/etc/redsocks-ssr-reudp.conf >/dev/null 2>&1
|
||||
elif [ "$stype" == "tun" ]; then
|
||||
@ -421,7 +451,7 @@ start_redir() {
|
||||
local dnsstr="$(uci_get_by_type global tunnel_forward 8.8.4.4:53)"
|
||||
local dnsserver=$(echo "$dnsstr" | awk -F ':' '{print $1}')
|
||||
local dnsport=$(echo "$dnsstr" | awk -F ':' '{print $2}')
|
||||
if [ "$ssr_dns" == "1" ]; then
|
||||
if [ "$ssr_dns" != "0" ]; then # not use custom dns service
|
||||
if [ "$run_mode" == "gfw" ]; then
|
||||
ipset add gfwlist $dnsserver 2>/dev/null
|
||||
elif [ "$run_mode" == "oversea" ]; then
|
||||
@ -429,12 +459,14 @@ start_redir() {
|
||||
else
|
||||
ipset add ss_spec_wan_ac $dnsserver nomatch 2>/dev/null
|
||||
fi
|
||||
fi
|
||||
if [ "$ssr_dns" == "1" ]; then
|
||||
start_pdnsd $dnsserver $dnsport
|
||||
pdnsd_enable_flag=1
|
||||
elif [ "$ssr_dns" == "2" ]; then
|
||||
microsocks -i 127.0.0.1 -p 10802 ssr-dns >/dev/null 2>&1 &
|
||||
dns2socks 127.0.0.1:10802 $dnsserver:$dnsport 127.0.0.1:5335 -q >/dev/null 2>&1 &
|
||||
pdnsd_enable_flag=2
|
||||
microsocks -i 127.0.0.1 -p 10802 ssr-dns >/dev/null 2>&1 &
|
||||
dns2socks 127.0.0.1:10802 $dnsserver:$dnsport 127.0.0.1:5335 -q >/dev/null 2>&1 &
|
||||
pdnsd_enable_flag=2
|
||||
fi
|
||||
if [ "$(uci_get_by_type global enable_switch)" == "1" ]; then
|
||||
if [ "$(uci_get_by_name $GLOBAL_SERVER switch_enable 1)" == "1" ]; then
|
||||
@ -558,31 +590,41 @@ start() {
|
||||
GLOBAL_SERVER=$switch_server
|
||||
switch_enable=1
|
||||
fi
|
||||
|
||||
NETFLIX_SERVER=$(uci_get_by_type global netflix_server same)
|
||||
if [ "$NETFLIX_SERVER" == "same" ]; then
|
||||
NETFLIX_SERVER=$GLOBAL_SERVER
|
||||
fi
|
||||
|
||||
if rules; then
|
||||
start_redir
|
||||
if ! [ "$(uci_get_by_type global pdnsd_enable)" = "2" ] ;then
|
||||
mkdir -p /tmp/dnsmasq.d && cp -a /etc/dnsmasq.ssr /tmp/ && cp -a /etc/dnsmasq.oversea /tmp/
|
||||
if ! [ "$run_mode" = "oversea" ] ;then
|
||||
echo "conf-dir=/tmp/dnsmasq.ssr" > /tmp/dnsmasq.d/dnsmasq-ssr.conf
|
||||
else
|
||||
echo "conf-dir=/tmp/dnsmasq.oversea" > /tmp/dnsmasq.d/dnsmasq-ssr.conf
|
||||
fi
|
||||
if [ $(uci_get_by_type global adblock 0) == "0" ] ;then
|
||||
rm -f /tmp/dnsmasq.ssr/ad.conf
|
||||
fi
|
||||
/usr/share/shadowsocksr/gfw2ipset.sh
|
||||
|
||||
cat /etc/config/netflix.list | while read line || [ -n "$line" ];
|
||||
do
|
||||
sed -i "/$line/d" /tmp/dnsmasq.ssr/gfw_list.conf
|
||||
done
|
||||
|
||||
awk '!/^$/&&!/^#/{printf("ipset=/.%s/'"netflix"'\n",$0)}' /etc/config/netflix.list > /tmp/dnsmasq.ssr/netflix_forward.conf
|
||||
awk '!/^$/&&!/^#/{printf("server=/.%s/'"127.0.0.1#5555"'\n",$0)}' /etc/config/netflix.list >> /tmp/dnsmasq.ssr/netflix_forward.conf
|
||||
|
||||
/etc/init.d/dnsmasq restart >/dev/null 2>&1
|
||||
mkdir -p /tmp/dnsmasq.d && cp -a /etc/dnsmasq.ssr /tmp/ && cp -a /etc/dnsmasq.oversea /tmp/
|
||||
if ! [ "$run_mode" == "oversea" ]; then
|
||||
cat <<-EOF >/tmp/dnsmasq.d/dnsmasq-ssr.conf
|
||||
conf-dir=/tmp/dnsmasq.ssr
|
||||
EOF
|
||||
else
|
||||
cat <<-EOF >/tmp/dnsmasq.d/dnsmasq-ssr.conf
|
||||
conf-dir=/tmp/dnsmasq.oversea
|
||||
EOF
|
||||
fi
|
||||
if [ $(uci_get_by_type global adblock 0) == "0" ]; then
|
||||
rm -f /tmp/dnsmasq.ssr/ad.conf
|
||||
fi
|
||||
/usr/share/shadowsocksr/gfw2ipset.sh
|
||||
|
||||
if [ "$NETFLIX_SERVER" != "same" ]; then
|
||||
cat /etc/config/netflix.list | while read line || [ -n "$line" ];
|
||||
do
|
||||
sed -i "/$line/d" /tmp/dnsmasq.ssr/gfw_list.conf
|
||||
done
|
||||
awk '!/^$/&&!/^#/{printf("ipset=/.%s/'"netflix"'\n",$0)}' /etc/config/netflix.list > /tmp/dnsmasq.ssr/netflix_forward.conf
|
||||
awk '!/^$/&&!/^#/{printf("server=/.%s/'"127.0.0.1#5555"'\n",$0)}' /etc/config/netflix.list >> /tmp/dnsmasq.ssr/netflix_forward.conf
|
||||
else
|
||||
rm -f /tmp/dnsmasq.ssr/netflix_forward.conf
|
||||
fi
|
||||
|
||||
/etc/init.d/dnsmasq restart >/dev/null 2>&1
|
||||
fi
|
||||
start_server
|
||||
start_local
|
||||
@ -642,13 +684,14 @@ stop() {
|
||||
killall -q -9 ssr-local
|
||||
killall -q -9 ss-local
|
||||
killall -q -9 kcptun-client
|
||||
killall -q -9 pdnsd
|
||||
killall -q -9 dns2socks
|
||||
killall -q -9 microsocks
|
||||
killall -q -9 redsocks2
|
||||
killall -q -9 pdnsd
|
||||
if [ -f "/tmp/dnsmasq.d/dnsmasq-ssr.conf" ]; then
|
||||
rm -f /tmp/dnsmasq.d/dnsmasq-ssr.conf
|
||||
/etc/init.d/dnsmasq restart >/dev/null 2>&1
|
||||
fi
|
||||
del_cron
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
if [ -f /tmp/adnew.conf ]; then
|
||||
if (grep -wq "address=" /tmp/adnew.conf) ; then
|
||||
cp /tmp/adnew.conf /tmp/ad.conf
|
||||
@ -7,4 +6,4 @@ if [ -f /tmp/adnew.conf ]; then
|
||||
cat /tmp/adnew.conf | grep ^\|\|[^\*]*\^$ | sed -e 's:||:address\=\/:' -e 's:\^:/0\.0\.0\.0:' > /tmp/ad.conf
|
||||
fi
|
||||
fi
|
||||
|
||||
rm -f /tmp/adnew.conf
|
||||
|
||||
@ -71,7 +71,6 @@ flush_r() {
|
||||
ipset -X oversea 2>/dev/null
|
||||
ipset -X whitelist 2>/dev/null
|
||||
ipset -X blacklist 2>/dev/null
|
||||
ipset -X netflix 2>/dev/null
|
||||
[ -n "$FWI" ] && echo '#!/bin/sh' >$FWI
|
||||
return 0
|
||||
}
|
||||
@ -120,6 +119,10 @@ ipset_r() {
|
||||
$IPT -I SS_SPEC_WAN_AC -m set --match-set whitelist dst -j RETURN
|
||||
for ip in $WAN_BP_IP; do ipset -! add whitelist $ip; done
|
||||
for ip in $WAN_FW_IP; do ipset -! add blacklist $ip; done
|
||||
|
||||
if [ "$NETFLIX" == "1" ]; then
|
||||
$IPT -I SS_SPEC_WAN_AC -p tcp -m set --match-set netflix dst -j REDIRECT --to-ports 4321
|
||||
fi
|
||||
return $?
|
||||
}
|
||||
|
||||
@ -134,7 +137,6 @@ fw_rule() {
|
||||
$IPT -A SS_SPEC_WAN_FW -d 192.168.0.0/16 -j RETURN
|
||||
$IPT -A SS_SPEC_WAN_FW -d 224.0.0.0/4 -j RETURN
|
||||
$IPT -A SS_SPEC_WAN_FW -d 240.0.0.0/4 -j RETURN
|
||||
$IPT -A SS_SPEC_WAN_FW -p tcp -m set --match-set netflix dst -j REDIRECT --to-ports 4321
|
||||
$IPT -A SS_SPEC_WAN_FW -p tcp $PROXY_PORTS \
|
||||
-j REDIRECT --to-ports $local_port 2>/dev/null || {
|
||||
loger 3 "Can't redirect, please check the iptables."
|
||||
@ -294,7 +296,7 @@ gen_include() {
|
||||
return 0
|
||||
}
|
||||
|
||||
while getopts ":s:l:S:L:i:e:a:B:b:w:p:G:D:oOuUfgrczh" arg; do
|
||||
while getopts ":s:l:S:L:i:e:a:B:b:w:p:G:D:F:oOuUfgrczh" arg; do
|
||||
case "$arg" in
|
||||
s)
|
||||
server=$OPTARG
|
||||
@ -335,6 +337,9 @@ while getopts ":s:l:S:L:i:e:a:B:b:w:p:G:D:oOuUfgrczh" arg; do
|
||||
D)
|
||||
PROXY_PORTS=$OPTARG
|
||||
;;
|
||||
F)
|
||||
NETFLIX=$OPTARG
|
||||
;;
|
||||
o)
|
||||
OUTPUT=1
|
||||
;;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user