luci-app-ssr-plus:Add gfwlist update URL (#3965)

This commit is contained in:
Mattraks 2020-03-24 11:27:30 +08:00 committed by GitHub
parent 9cbca25d79
commit 5b7fec3ab6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 261 additions and 19176 deletions

View File

@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-ssr-plus
PKG_VERSION:=173
PKG_RELEASE:=6
PKG_RELEASE:=7
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
@ -68,9 +68,6 @@ define Package/$(PKG_NAME)/conffiles
endef
define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/etc
$(INSTALL_DATA) ./root/etc/china_ssr.txt $(1)/etc/china_ssr.txt
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_CONF) ./root/etc/config/shadowsocksr $(1)/etc/config/shadowsocksr
$(INSTALL_DATA) ./root/etc/config/*.list $(1)/etc/config/

View File

@ -75,7 +75,7 @@ function refresh_data()
local uci = luci.model.uci.cursor()
local icount = 0
if set == "gfw_data" then
refresh_cmd="wget-ssl --no-check-certificate -O - https://cdn.jsdelivr.net/gh/gfwlist/gfwlist/gfwlist.txt > /tmp/gfw.b64"
refresh_cmd = "wget-ssl --no-check-certificate -O- " .. uci:get_first('shadowsocksr', 'global', 'gfwlist_url', 'https://cdn.jsdelivr.net/gh/gfwlist/gfwlist/gfwlist.txt') .. ' > /tmp/gfw.b64'
sret = luci.sys.call(refresh_cmd .. " 2>/dev/null")
if sret == 0 then
luci.sys.call("/usr/bin/ssr-gfw")
@ -97,7 +97,8 @@ function refresh_data()
else
retstring = "-1"
end
elseif set == "ip_data" then
end
if set == "ip_data" then
refresh_cmd = "wget-ssl --no-check-certificate -O- " .. uci:get_first('shadowsocksr', 'global', 'chnroute_url', 'https://ispip.clang.cn/all_cn.txt') .. ' > /tmp/china_ssr.txt'
sret = luci.sys.call(refresh_cmd .. " 2>/dev/null")
icount = luci.sys.exec("cat /tmp/china_ssr.txt | wc -l")
@ -114,7 +115,8 @@ function refresh_data()
retstring = "-1"
end
luci.sys.exec("rm -f /tmp/china_ssr.txt")
elseif set == "nfip_data" then
end
if set == "nfip_data" then
refresh_cmd = "wget-ssl --no-check-certificate -O- ".. uci:get_first('shadowsocksr', 'global', 'nfip_url','https://raw.githubusercontent.com/QiuSimons/Netflix_IP/master/NF_only.txt') .." > /tmp/netflixip.list"
sret = luci.sys.call(refresh_cmd .. " 2>/dev/null")
icount = luci.sys.exec("cat /tmp/netflixip.list | wc -l")
@ -131,7 +133,8 @@ function refresh_data()
retstring = "-1"
end
luci.sys.exec("rm -f /tmp/netflixip.list")
else
end
if set == "ad_data" then
refresh_cmd = "wget-ssl --no-check-certificate -O- ".. uci:get_first('shadowsocksr', 'global', 'adblock_url','https://easylist-downloads.adblockplus.org/easylistchina+easylist.txt') .." > /tmp/adnew.conf"
sret = luci.sys.call(refresh_cmd .. " 2>/dev/null")
if sret == 0 then
@ -168,10 +171,9 @@ function check_port()
local retstring = "<br /><br />"
local s
local server_name = ""
local shadowsocksr="shadowsocksr"
local uci = luci.model.uci.cursor()
local iret = 1
uci:foreach(shadowsocksr, "servers", function(s)
uci:foreach("shadowsocksr", "servers", function(s)
if s.alias then
server_name = s.alias
elseif s.server and s.server_port then

View File

@ -45,6 +45,20 @@ o.datatype = "uinteger"
o:depends("enable_switch", "1")
o.default = 3
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("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")
o = s:option(Value, "gfwlist_url", translate("gfwlist Update url"))
o:value("https://cdn.jsdelivr.net/gh/Loukky/gfwlist-by-loukky/gfwlist.txt", translate("Loukky/gfwlist-by-loukky"))
o:value("https://cdn.jsdelivr.net/gh/gfwlist/gfwlist/gfwlist.txt", translate("gfwlist/gfwlist"))
o.default = "https://cdn.jsdelivr.net/gh/gfwlist/gfwlist/gfwlist.txt"
o = s:option(Value, "chnroute_url", translate("Chnroute Update url"))
o:value("https://ispip.clang.cn/all_cn.txt", translate("Clang.CN"))
o.default = "https://ispip.clang.cn/all_cn.txt"
@ -55,15 +69,6 @@ o:value("https://raw.githubusercontent.com/QiuSimons/Netflix_IP/master/getflix.t
o.default = "https://raw.githubusercontent.com/QiuSimons/Netflix_IP/master/NF_only.txt"
o.description = translate("Customize Netflix IP Url")
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("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")
-- [[ SOCKS5 Proxy ]]--
s = m:section(TypedSection, "socks5_proxy", translate("Global SOCKS5 Proxy Server"))
s.anonymous = true

View File

@ -166,12 +166,6 @@ msgstr "编辑服务器配置"
msgid "Alias"
msgstr "别名"
msgid "SOCKS Proxy"
msgstr "SOCKS(4/5)代理"
msgid "Enable SOCKS Proxy"
msgstr "启用 SOCKS 代理"
msgid "Server"
msgstr "服务器"
@ -283,6 +277,9 @@ msgstr "【国内IP段】数据库"
msgid "Netflix IP Data"
msgstr "【Netflix IP段】数据库"
msgid "Advertising Data"
msgstr "【广告屏蔽】数据库"
msgid "Records"
msgstr "条记录"
@ -332,10 +329,16 @@ msgid "Enable adblock"
msgstr "启用广告屏蔽"
msgid "adblock_url"
msgstr "广告屏蔽订阅"
msgstr "广告屏蔽更新URL"
msgid "gfwlist Update url"
msgstr "GFWList更新URL"
msgid "Chnroute Update url"
msgstr "国内IP段更新URL"
msgid "nfip_url"
msgstr "Netflix IP更新URL"
msgstr "Netflix IP更新URL"
msgid "Customize Netflix IP Url"
msgstr "自定义Netflix IP更新URL默认项目地址https://github.com/QiuSimons/Netflix_IP"
@ -343,15 +346,6 @@ msgstr "自定义Netflix IP更新URL默认项目地址https://github.com/Q
msgid "Enable Process Deamon"
msgstr "启用进程自动守护"
msgid "Advertising Data"
msgstr "【广告屏蔽】数据库"
msgid "Chnroute Setting"
msgstr "国内IP段数据库更新设置"
msgid "Update url"
msgstr "更新链接"
msgid "DNS Server IP and Port"
msgstr "DNS服务器地址和端口"
@ -496,24 +490,12 @@ msgstr "游戏模式UDP中继服务器"
msgid "Game Mode UDP Relay"
msgstr "游戏模式UDP中继"
msgid "adblock settings"
msgstr "广告屏蔽设置"
msgid "Server failsafe auto swith and custom update settings"
msgstr "服务器节点故障自动切换/广告屏蔽/国内IP段数据库更新设置"
msgid "Support AdGuardHome and DNSMASQ format list"
msgstr "同时支持 AdGuard Home 和 DNSMASQ 格式的过滤列表"
msgid "Enable Custom Chnroute"
msgstr "自定义国内IP段数据库更新"
msgid "Chnroute Update url"
msgstr "国内IP段数据库更新URL"
msgid "Delete all severs"
msgstr "删除所有服务器节点"
msgid "Delete All Subscribe Severs"
msgstr "删除所有订阅服务器节点"

File diff suppressed because it is too large Load Diff

View File

@ -11,14 +11,13 @@ config global
option switch_timeout '5'
option switch_time '667'
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 gfwlist_url 'https://raw.githubusercontent.com/Loukky/gfwlist-by-loukky/master/gfwlist.txt'
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 adblock_url 'https://gitee.com/privacy-protection-tools/anti-ad/raw/master/anti-ad-for-dnsmasq.conf'
option netflix_server 'same'
option threads '0'
config socks5_proxy
option socks '0'
option local_port '1080'

View File

@ -91,7 +91,7 @@ gen_config_file() {
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=$(cat /etc/ssr_ip)
hostip=$(cat /tmp/ssr_ip)
fi
fi
[ "$2" == "0" -a "$kcp_flag" == "1" ] && hostip="127.0.0.1"
@ -179,9 +179,9 @@ start_rules() {
else
server=$(ping $server -W 1 -s 1 -c 1 | grep PING | cut -d'(' -f 2 | cut -d')' -f1)
if echo $server | grep -E "^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$" >/dev/null; then
echo $server >/etc/ssr_ip
echo $server >/tmp/ssr_ip
else
server=$(cat /etc/ssr_ip)
server=$(cat /tmp/ssr_ip)
fi
fi
kcp_server=$server
@ -435,7 +435,6 @@ start_redir() {
fi
fi
if [ -n "$UDP_RELAY_SERVER" ]; then
redir_udp=1
if [ "$utype" == "ss" -o "$utype" == "ssr" ]; then
@ -643,28 +642,24 @@ start() {
/usr/share/shadowsocksr/gfw2ipset.sh
if [ "$NETFLIX_SERVER" != "$GLOBAL_SERVER" ]; then
cat /etc/config/netflix.list | while read line || [ -n "$line" ];
do
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
cat /etc/config/netflixip.list | while read nip || [ -n "$nip" ]; do
ipset add netflix $nip 2>/dev/null
done
else
cat /etc/config/netflix.list | while read line || [ -n "$line" ];
do
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
cat /etc/config/netflixip.list | while read nip || [ -n "$nip" ]; do
ipset add netflix $nip 2>/dev/null
done
fi
@ -739,7 +734,7 @@ stop() {
kill -9 $(busybox ps -w | grep pdnsd | grep -v grep | awk '{print $1}') >/dev/null 2>&1
fi
if [ -f "/tmp/dnsmasq.d/dnsmasq-ssr.conf" ]; then
rm -f /tmp/dnsmasq.d/dnsmasq-ssr.conf
rm -f /tmp/dnsmasq.d/dnsmasq-ssr.conf /tmp/dnsmasq.ssr/* /tmp/dnsmasq.oversea/*
/etc/init.d/dnsmasq restart >/dev/null 2>&1
fi
del_cron

View File

@ -15,7 +15,7 @@ local log = function(...)
end
log('正在更新【GFW列表】数据库')
refresh_cmd = "wget-ssl --no-check-certificate -O - https://cdn.jsdelivr.net/gh/gfwlist/gfwlist/gfwlist.txt > /tmp/gfw.b64"
refresh_cmd = "wget-ssl --no-check-certificate -O- " .. uci:get_first('shadowsocksr', 'global', 'gfwlist_url', 'https://cdn.jsdelivr.net/gh/gfwlist/gfwlist/gfwlist.txt') .. ' > /tmp//tmp/gfw.b64'
sret = luci.sys.call(refresh_cmd .. " 2>/dev/null")
if sret == 0 then
luci.sys.call("/usr/bin/ssr-gfw")