mirror of
https://github.com/hanwckf/immortalwrt-mt798x.git
synced 2025-01-10 11:09:57 +08:00
luci-app-ssr-plus: sync with Lean's source
This commit is contained in:
parent
9060f9e046
commit
379c9359f5
@ -1,8 +1,8 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-ssr-plus
|
||||
PKG_VERSION:=169
|
||||
PKG_RELEASE:=6
|
||||
PKG_VERSION:=170
|
||||
PKG_RELEASE:=5
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
|
||||
|
||||
|
@ -116,6 +116,27 @@ elseif set == "ip_data" then
|
||||
retstring ="-1"
|
||||
end
|
||||
luci.sys.exec("rm -f /tmp/china_ssr.txt ")
|
||||
elseif set == "nfip_data" then
|
||||
if (luci.model.uci.cursor():get_first('shadowsocksr', 'global', 'netflix', '0') == '1') then
|
||||
refresh_cmd="wget-ssl --no-check-certificate -O - ".. luci.model.uci.cursor():get_first('shadowsocksr', 'global', 'nfip_url', 'https://raw.githubusercontent.com/QiuSimons/Netflix_IP/master/NF_only.txt') .." > /tmp/netflixip.list"
|
||||
else
|
||||
refresh_cmd="wget-ssl --no-check-certificate -O - https://raw.githubusercontent.com/QiuSimons/Netflix_IP/master/NF_only.txt > /tmp/netflixip.list"
|
||||
end
|
||||
sret=luci.sys.call(refresh_cmd)
|
||||
icount = luci.sys.exec("cat /tmp/netflixip.list | wc -l")
|
||||
if sret== 0 and tonumber(icount)>1 then
|
||||
oldcount=luci.sys.exec("cat /etc/config/netflixip.list | wc -l")
|
||||
if tonumber(icount) ~= tonumber(oldcount) then
|
||||
luci.sys.exec("cp -f /tmp/netflixip.list /etc/config/netflixip.list")
|
||||
luci.sys.exec("/etc/init.d/shadowsocksr restart &")
|
||||
retstring=tostring(tonumber(icount))
|
||||
else
|
||||
retstring ="0"
|
||||
end
|
||||
else
|
||||
retstring ="-1"
|
||||
end
|
||||
luci.sys.exec("rm -f /tmp/netflixip.list ")
|
||||
else
|
||||
if nixio.fs.access("/usr/bin/wget-ssl") then
|
||||
refresh_cmd="wget-ssl --no-check-certificate -O - ".. luci.model.uci.cursor():get_first('shadowsocksr', 'global', 'adblock_url','https://easylist-downloads.adblockplus.org/easylistchina+easylist.txt') .." > /tmp/adnew.conf"
|
||||
|
@ -42,6 +42,14 @@ o.default = "https://gitee.com/privacy-protection-tools/anti-ad/raw/master/anti-
|
||||
o:depends("adblock", "1")
|
||||
o.description = translate("Support AdGuardHome and DNSMASQ format list")
|
||||
|
||||
o = s:option(Flag, "netflix", translate("Enable Custom Netflix IP Url"))
|
||||
o.rmempty = false
|
||||
|
||||
o = s:option(Value, "nfip_url", translate("nfip_url"))
|
||||
o.default = "https://raw.githubusercontent.com/QiuSimons/Netflix_IP/master/NF_only.txt"
|
||||
o:depends("netflix", "1")
|
||||
o.description = translate("Customize Netflix IP Url")
|
||||
|
||||
-- [[ SOCKS Proxy ]]--
|
||||
if nixio.fs.access("/usr/bin/microsocks") then
|
||||
s = m:section(TypedSection, "socks5_proxy", translate("SOCKS5 Proxy Server Settings"))
|
||||
|
@ -14,6 +14,7 @@ local udpspeeder_run=0
|
||||
local gfw_count=0
|
||||
local ad_count=0
|
||||
local ip_count=0
|
||||
local nfip_count=0
|
||||
local ucic = luci.model.uci.cursor()
|
||||
local shadowsocksr = "shadowsocksr"
|
||||
-- html constants
|
||||
@ -51,6 +52,10 @@ if nixio.fs.access("/etc/china_ssr.txt") then
|
||||
ip_count = sys.exec("cat /etc/china_ssr.txt | wc -l")
|
||||
end
|
||||
|
||||
if nixio.fs.access("/etc/config/netflixip.list") then
|
||||
nfip_count = sys.exec("cat /etc/config/netflixip.list | wc -l")
|
||||
end
|
||||
|
||||
local icount=sys.exec("busybox ps -w | grep ssr-reudp |grep -v grep| wc -l")
|
||||
if tonumber(icount)>0 then
|
||||
reudp_run=1
|
||||
@ -169,6 +174,11 @@ s.rawhtml = true
|
||||
s.template = "shadowsocksr/refresh"
|
||||
s.value =ip_count .. " " .. translate("Records")
|
||||
|
||||
s=m:field(DummyValue,"nfip_data",translate("Netflix IP Data"))
|
||||
s.rawhtml = true
|
||||
s.template = "shadowsocksr/refresh"
|
||||
s.value =nfip_count .. " " .. translate("Records")
|
||||
|
||||
if ucic:get_first(shadowsocksr, 'global', 'adblock', '0') == '1' then
|
||||
s=m:field(DummyValue,"ad_data",translate("Advertising Data"))
|
||||
s.rawhtml = true
|
||||
|
@ -280,6 +280,9 @@ msgstr "【GFW列表】数据库"
|
||||
msgid "China IP Data"
|
||||
msgstr "【国内IP段】数据库"
|
||||
|
||||
msgid "Netflix IP Data"
|
||||
msgstr "【Netflix IP段】数据库"
|
||||
|
||||
msgid "Records"
|
||||
msgstr "条记录"
|
||||
|
||||
@ -331,6 +334,15 @@ msgstr "启用广告屏蔽"
|
||||
msgid "adblock_url"
|
||||
msgstr "广告屏蔽订阅"
|
||||
|
||||
msgid "Enable Custom Netflix IP Url"
|
||||
msgstr "启用自定义Netflix IP更新URL"
|
||||
|
||||
msgid "nfip_url"
|
||||
msgstr "Netflix IP更新URL"
|
||||
|
||||
msgid "Customize Netflix IP Url"
|
||||
msgstr "自定义Netflix IP更新URL(默认项目地址:https://github.com/QiuSimons/Netflix_IP)"
|
||||
|
||||
msgid "Enable Process Deamon"
|
||||
msgstr "启用进程自动守护"
|
||||
|
||||
|
@ -3993,6 +3993,12 @@
|
||||
103.147.211.0/24
|
||||
103.148.174.0/23
|
||||
103.149.6.0/23
|
||||
103.149.17.0/24
|
||||
103.149.44.0/23
|
||||
103.149.110.0/23
|
||||
103.149.132.0/23
|
||||
103.149.144.0/23
|
||||
103.149.156.0/23
|
||||
103.192.0.0/22
|
||||
103.192.4.0/22
|
||||
103.192.8.0/22
|
||||
@ -4082,7 +4088,6 @@
|
||||
103.199.248.0/22
|
||||
103.199.252.0/22
|
||||
103.200.28.0/22
|
||||
103.200.32.0/22
|
||||
103.200.52.0/22
|
||||
103.200.64.0/22
|
||||
103.200.68.0/22
|
||||
@ -6160,7 +6165,10 @@
|
||||
172.81.192.0/18
|
||||
175.0.0.0/12
|
||||
175.16.0.0/13
|
||||
175.24.0.0/14
|
||||
175.24.0.0/16
|
||||
175.25.0.0/16
|
||||
175.26.0.0/16
|
||||
175.27.0.0/16
|
||||
175.30.0.0/15
|
||||
175.42.0.0/15
|
||||
175.44.0.0/16
|
||||
|
@ -1,9 +1,23 @@
|
||||
amazonaws.com
|
||||
aws.amazon.com
|
||||
awsstatic.com
|
||||
fast.com
|
||||
netflix.com
|
||||
netflix.net
|
||||
nflximg.net
|
||||
nflxvideo.net
|
||||
nflxso.net
|
||||
nflxext.com
|
||||
nflximg.net
|
||||
nflxso.net
|
||||
nflxvideo.net
|
||||
netflixdnstest0.com
|
||||
netflixdnstest1.com
|
||||
netflixdnstest2.com
|
||||
netflixdnstest3.com
|
||||
netflixdnstest4.com
|
||||
netflixdnstest5.com
|
||||
netflixdnstest6.com
|
||||
netflixdnstest7.com
|
||||
netflixdnstest8.com
|
||||
netflixdnstest9.com
|
||||
hulu.com
|
||||
huluim.com
|
||||
hbonow.com
|
||||
|
@ -2,7 +2,8 @@
|
||||
config global
|
||||
option tunnel_forward '8.8.4.4:53'
|
||||
option tunnel_address '0.0.0.0'
|
||||
option run_mode 'gfw'
|
||||
option run_mode 'router'
|
||||
option dports '2'
|
||||
option pdnsd_enable '1'
|
||||
option monitor_enable '1'
|
||||
option global_server 'nil'
|
||||
@ -12,9 +13,11 @@ config global
|
||||
option switch_try_count '3'
|
||||
option adblock '0'
|
||||
option adblock_url 'https://gitee.com/privacy-protection-tools/anti-ad/raw/master/anti-ad-for-dnsmasq.conf'
|
||||
option chnroute '0'
|
||||
option chnroute '1'
|
||||
option chnroute_url 'https://ispip.clang.cn/all_cn.txt'
|
||||
option nfip_url 'https://raw.githubusercontent.com/QiuSimons/Netflix_IP/master/NF_only.txt'
|
||||
option netflix_server 'same'
|
||||
option threads '0'
|
||||
|
||||
|
||||
config socks5_proxy
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -47,6 +47,23 @@ uci_get_by_cfgid() {
|
||||
echo ${ret:=$3}
|
||||
}
|
||||
|
||||
check_host() {
|
||||
local host=$1
|
||||
if echo $host | grep -E "^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$" >/dev/null; then
|
||||
hostip=$host
|
||||
elif [ "$host" != "${host#*:[0-9a-fA-F]}" ]; then
|
||||
hostip=$host
|
||||
else
|
||||
hostip=$(ping $host -W 1 -s 1 -c 1 | grep PING | cut -d'(' -f 2 | cut -d')' -f1)
|
||||
if echo $hostip | grep -E "^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$" >/dev/null; then
|
||||
hostip=$hostip
|
||||
else
|
||||
hostip="127.0.0.1"
|
||||
fi
|
||||
fi
|
||||
echo -e $hostip
|
||||
}
|
||||
|
||||
add_cron() {
|
||||
sed -i '/shadowsocksr/d' $CRON_FILE
|
||||
sed -i '/ssrplus.log/d' $CRON_FILE && echo '0 1 * * * echo "" > /tmp/ssrplus.log' >>$CRON_FILE
|
||||
@ -206,7 +223,7 @@ start_rules() {
|
||||
else
|
||||
proxyport="-m multiport --dports 22,53,587,465,995,993,143,80,443"
|
||||
fi
|
||||
if [ "$NETFLIX_SERVER" != "same" ]; then
|
||||
if [ "$NETFLIX_SERVER" != "$GLOBAL_SERVER" ]; then
|
||||
netflix="1"
|
||||
else
|
||||
netflix="0"
|
||||
@ -367,7 +384,7 @@ start_redir() {
|
||||
echo "$(date "+%Y-%m-%d %H:%M:%S") $($sscmd --version 2>&1 | head -1) , $threads Threads Started!" >>/tmp/ssrplus.log
|
||||
elif [ "$stype" == "socks5" ]; then
|
||||
/usr/share/shadowsocksr/genred2config.sh "/var/etc/redsocks-ssr-retcp.conf" socks5 tcp $(uci_get_by_name $GLOBAL_SERVER local_port) \
|
||||
$(uci_get_by_name $GLOBAL_SERVER server) $(uci_get_by_name $GLOBAL_SERVER server_port) \
|
||||
$(check_host $(uci_get_by_name $GLOBAL_SERVER server)) $(uci_get_by_name $GLOBAL_SERVER server_port) \
|
||||
$(uci_get_by_name $GLOBAL_SERVER auth_enable 0) $(uci_get_by_name $GLOBAL_SERVER username) $(uci_get_by_name $GLOBAL_SERVER password)
|
||||
for i in $(seq 1 $threads); do
|
||||
$sscmd -c /var/etc/redsocks-ssr-retcp.conf >/dev/null 2>&1
|
||||
@ -381,7 +398,7 @@ start_redir() {
|
||||
echo "$(date "+%Y-%m-%d %H:%M:%S") Network Tunnel REDIRECT $threads Threads Started!" >>/tmp/ssrplus.log
|
||||
fi
|
||||
|
||||
if [ "$NETFLIX_SERVER" != "same" ]; then
|
||||
if [ "$NETFLIX_SERVER" != "$GLOBAL_SERVER" ]; then
|
||||
if [ "$ntype" == "ss" -o "$ntype" == "ssr" ]; then
|
||||
gen_config_file $NETFLIX_SERVER 2 4321
|
||||
gen_config_file $NETFLIX_SERVER 3 1088
|
||||
@ -402,7 +419,7 @@ start_redir() {
|
||||
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) \
|
||||
$(check_host $(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 &
|
||||
@ -438,7 +455,7 @@ start_redir() {
|
||||
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) \
|
||||
$(check_host $(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
|
||||
@ -613,13 +630,21 @@ start() {
|
||||
fi
|
||||
/usr/share/shadowsocksr/gfw2ipset.sh
|
||||
|
||||
if [ "$NETFLIX_SERVER" != "same" ]; then
|
||||
if [ "$NETFLIX_SERVER" != "$GLOBAL_SERVER" ]; 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
|
||||
|
||||
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
|
||||
|
||||
ipset add ss_spec_wan_ac $(check_host $(uci_get_by_name $NETFLIX_SERVER server)) 2>/dev/null
|
||||
else
|
||||
rm -f /tmp/dnsmasq.ssr/netflix_forward.conf
|
||||
fi
|
||||
@ -694,4 +719,3 @@ stop() {
|
||||
fi
|
||||
del_cron
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user