luci-app-ssr-plus: enhance Netflix rules at "same" mode

This commit is contained in:
lean 2020-03-23 23:54:17 +08:00
parent fb6ab3dc56
commit 8ac78f3f51
6 changed files with 20 additions and 7 deletions

View File

@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-ssr-plus
PKG_VERSION:=173
PKG_RELEASE:=3
PKG_RELEASE:=5
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)

View File

@ -47,7 +47,7 @@ function act_ping()
socket:setopt("socket", "sndtimeo", 3)
e.socket = socket:connect(domain, port)
socket:close()
e.ping = luci.sys.exec(string.format("echo -n $(tcpping -c 1 -i 1 -p %s %s 2>&1 | grep -o 'time=[0-9]*.[0-9]' | awk -F '=' '{print$2}') 2>/dev/null",port, domain))
e.ping = luci.sys.exec(string.format("echo -n $(tcpping -c 1 -i 1 -p %s %s 2>&1 | grep -o 'ttl=[0-9]* time=[0-9]*.[0-9]' | awk -F '=' '{print$3}') 2>/dev/null",port, domain))
if (e.ping == "") then
e.ping = luci.sys.exec("ping -c 1 -W 1 %q 2>&1 | grep -o 'time=[0-9]*.[0-9]' | awk -F '=' '{print$2}'" % domain)
end

View File

@ -46,11 +46,12 @@ o:depends("enable_switch", "1")
o.default = 3
o = s:option(Value, "chnroute_url", translate("Chnroute Update url"))
o:value("https://ispip.clang.cn/all_cn.txt", translate("https://ispip.clang.cn/all_cn.txt"))
o:value("https://ispip.clang.cn/all_cn.txt", translate("Clang.CN"))
o.default = "https://ispip.clang.cn/all_cn.txt"
o = s:option(Value, "nfip_url", translate("nfip_url"))
o:value("https://raw.githubusercontent.com/QiuSimons/Netflix_IP/master/NF_only.txt", translate("https://raw.githubusercontent.com/QiuSimons/Netflix_IP/master/NF_only.txt"))
o:value("https://raw.githubusercontent.com/QiuSimons/Netflix_IP/master/NF_only.txt", translate("Netflix IP Only"))
o:value("https://raw.githubusercontent.com/QiuSimons/Netflix_IP/master/getflix.txt", translate("Netflix and AWS"))
o.default = "https://raw.githubusercontent.com/QiuSimons/Netflix_IP/master/NF_only.txt"
o.description = translate("Customize Netflix IP Url")
@ -58,7 +59,7 @@ o = s:option(Flag, "adblock", translate("Enable adblock"))
o.rmempty = false
o = s:option(Value, "adblock_url", translate("adblock_url"))
o:value("https://gitee.com/privacy-protection-tools/anti-ad/raw/master/anti-ad-for-dnsmasq.conf", translate("https://gitee.com/privacy-protection-tools/anti-ad/raw/master/anti-ad-for-dnsmasq.conf"))
o:value("https://gitee.com/privacy-protection-tools/anti-ad/raw/master/anti-ad-for-dnsmasq.conf", translate("anti-AD"))
o.default = "https://gitee.com/privacy-protection-tools/anti-ad/raw/master/anti-ad-for-dnsmasq.conf"
o:depends("adblock", "1")
o.description = translate("Support AdGuardHome and DNSMASQ format list")

View File

@ -67,7 +67,7 @@ if luci.sys.call("busybox ps -w | grep ssr-retcp | grep -v grep >/dev/null") ==
redir_run=1
end
if luci.sys.call("busybox ps -w | grep ssr-local | grep -v grep >/dev/null") == 0 then
if luci.sys.call("busybox ps -w | grep ssr-local | grep -v ssr-socksdns |grep -v grep >/dev/null") == 0 then
sock5_run=1
end

View File

@ -656,7 +656,17 @@ start() {
ipset add netflix $nip 2>/dev/null
done
else
rm -f /tmp/dnsmasq.ssr/netflix_forward.conf
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#5335"'\n",$0)}' /etc/config/netflix.list >> /tmp/dnsmasq.ssr/netflix_forward.conf
ipset -N netflix hash:net 2>/dev/null
cat /etc/config/netflixip.list | while read nip || [ -n "$nip" ];
do
ipset add netflix $nip 2>/dev/null
done
fi
/etc/init.d/dnsmasq restart >/dev/null 2>&1

View File

@ -127,6 +127,8 @@ ipset_r() {
else
ipset -! add whitelist $NETFLIX_IP
fi
else
$IPT -I SS_SPEC_WAN_AC -p tcp -m set --match-set netflix dst -j REDIRECT --to-ports $local_port
fi
return $?