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_NAME:=luci-app-ssr-plus
PKG_VERSION:=173 PKG_VERSION:=173
PKG_RELEASE:=6 PKG_RELEASE:=7
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME) PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
@ -68,9 +68,6 @@ define Package/$(PKG_NAME)/conffiles
endef endef
define Package/$(PKG_NAME)/install 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_DIR) $(1)/etc/config
$(INSTALL_CONF) ./root/etc/config/shadowsocksr $(1)/etc/config/shadowsocksr $(INSTALL_CONF) ./root/etc/config/shadowsocksr $(1)/etc/config/shadowsocksr
$(INSTALL_DATA) ./root/etc/config/*.list $(1)/etc/config/ $(INSTALL_DATA) ./root/etc/config/*.list $(1)/etc/config/

View File

@ -9,7 +9,7 @@ function index()
end end
entry({"admin", "services", "shadowsocksr"}, alias("admin", "services", "shadowsocksr", "client"),_("ShadowSocksR Plus+"), 10).dependent = true entry({"admin", "services", "shadowsocksr"}, alias("admin", "services", "shadowsocksr", "client"),_("ShadowSocksR Plus+"), 10).dependent = true
entry({"admin", "services", "shadowsocksr", "client"}, cbi("shadowsocksr/client"),_("SSR Client"), 10).leaf = true entry({"admin", "services", "shadowsocksr", "client"}, cbi("shadowsocksr/client"),_("SSR Client"), 10).leaf = true
entry({"admin", "services", "shadowsocksr", "servers"}, arcombine(cbi("shadowsocksr/servers", {autoapply=true}), cbi("shadowsocksr/client-config")),_("Severs Nodes"), 20).leaf = true entry({"admin", "services", "shadowsocksr", "servers"}, arcombine(cbi("shadowsocksr/servers", {autoapply = true}), cbi("shadowsocksr/client-config")),_("Severs Nodes"), 20).leaf = true
entry({"admin", "services", "shadowsocksr", "control"},cbi("shadowsocksr/control"), _("Access Control"), 30).leaf = true entry({"admin", "services", "shadowsocksr", "control"},cbi("shadowsocksr/control"), _("Access Control"), 30).leaf = true
entry({"admin", "services", "shadowsocksr", "advanced"},cbi("shadowsocksr/advanced"),_("Advanced Settings"), 50).leaf = true entry({"admin", "services", "shadowsocksr", "advanced"},cbi("shadowsocksr/advanced"),_("Advanced Settings"), 50).leaf = true
entry({"admin", "services", "shadowsocksr", "server"},arcombine(cbi("shadowsocksr/server"), cbi("shadowsocksr/server-config")),_("SSR Server"), 60).leaf = true entry({"admin", "services", "shadowsocksr", "server"},arcombine(cbi("shadowsocksr/server"), cbi("shadowsocksr/server-config")),_("SSR Server"), 60).leaf = true
@ -19,19 +19,19 @@ function index()
entry({"admin", "services", "shadowsocksr", "subscribe"}, call("subscribe")) entry({"admin", "services", "shadowsocksr", "subscribe"}, call("subscribe"))
entry({"admin", "services", "shadowsocksr", "checkport"}, call("check_port")) entry({"admin", "services", "shadowsocksr", "checkport"}, call("check_port"))
entry({"admin", "services", "shadowsocksr", "log"},form("shadowsocksr/log"),_("Log"), 80).leaf = true entry({"admin", "services", "shadowsocksr", "log"},form("shadowsocksr/log"),_("Log"), 80).leaf = true
entry({"admin", "services", "shadowsocksr","run"},call("act_status")).leaf=true entry({"admin", "services", "shadowsocksr","run"},call("act_status")).leaf = true
entry({"admin", "services", "shadowsocksr", "ping"}, call("act_ping")).leaf=true entry({"admin", "services", "shadowsocksr", "ping"}, call("act_ping")).leaf = true
end end
function subscribe() function subscribe()
luci.sys.call("/usr/bin/lua /usr/share/shadowsocksr/subscribe.lua >> /tmp/ssrplus.log 2>&1") luci.sys.call("/usr/bin/lua /usr/share/shadowsocksr/subscribe.lua >> /tmp/ssrplus.log 2>&1")
luci.http.prepare_content("application/json") luci.http.prepare_content("application/json")
luci.http.write_json({ ret = 1 }) luci.http.write_json({ret = 1})
end end
function act_status() function act_status()
local e={} local e = {}
e.running=luci.sys.call("busybox ps -w | grep ssr-retcp | grep -v grep >/dev/null")==0 e.running = luci.sys.call("busybox ps -w | grep ssr-retcp | grep -v grep >/dev/null") == 0
luci.http.prepare_content("application/json") luci.http.prepare_content("application/json")
luci.http.write_json(e) luci.http.write_json(e)
end end
@ -62,136 +62,138 @@ function check_status()
local set = "/usr/bin/ssr-check www." .. luci.http.formvalue("set") .. ".com 80 3 1" local set = "/usr/bin/ssr-check www." .. luci.http.formvalue("set") .. ".com 80 3 1"
sret = luci.sys.call(set) sret = luci.sys.call(set)
if sret == 0 then if sret == 0 then
retstring ="0" retstring = "0"
else else
retstring ="1" retstring = "1"
end end
luci.http.prepare_content("application/json") luci.http.prepare_content("application/json")
luci.http.write_json({ ret=retstring }) luci.http.write_json({ret = retstring})
end end
function refresh_data() function refresh_data()
local set =luci.http.formvalue("set") local set = luci.http.formvalue("set")
local uci=luci.model.uci.cursor() local uci = luci.model.uci.cursor()
local icount =0 local icount = 0
if set == "gfw_data" then 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") sret = luci.sys.call(refresh_cmd .. " 2>/dev/null")
if sret == 0 then if sret == 0 then
luci.sys.call("/usr/bin/ssr-gfw") luci.sys.call("/usr/bin/ssr-gfw")
icount=luci.sys.exec("cat /tmp/gfwnew.txt | wc -l") icount = luci.sys.exec("cat /tmp/gfwnew.txt | wc -l")
if tonumber(icount) > 1000 then if tonumber(icount) > 1000 then
oldcount= luci.sys.exec("cat /etc/dnsmasq.ssr/gfw_list.conf | wc -l") oldcount = luci.sys.exec("cat /etc/dnsmasq.ssr/gfw_list.conf | wc -l")
if tonumber(icount) ~= tonumber(oldcount) then if tonumber(icount) ~= tonumber(oldcount) then
luci.sys.exec("cp -f /tmp/gfwnew.txt /etc/dnsmasq.ssr/gfw_list.conf") luci.sys.exec("cp -f /tmp/gfwnew.txt /etc/dnsmasq.ssr/gfw_list.conf")
luci.sys.exec("cp -f /tmp/gfwnew.txt /tmp/dnsmasq.ssr/gfw_list.conf") luci.sys.exec("cp -f /tmp/gfwnew.txt /tmp/dnsmasq.ssr/gfw_list.conf")
luci.sys.call("/etc/init.d/dnsmasq restart") luci.sys.call("/etc/init.d/dnsmasq restart")
retstring=tostring(tonumber(icount)/2) retstring = tostring(tonumber(icount)/2)
else else
retstring ="0" retstring = "0"
end end
else else
retstring="-1" retstring = "-1"
end end
luci.sys.exec("rm -f /tmp/gfwnew.txt") luci.sys.exec("rm -f /tmp/gfwnew.txt")
else else
retstring="-1" retstring = "-1"
end end
elseif set == "ip_data" then end
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' if set == "ip_data" then
sret=luci.sys.call(refresh_cmd .. " 2>/dev/null") 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'
icount=luci.sys.exec("cat /tmp/china_ssr.txt | wc -l") sret = luci.sys.call(refresh_cmd .. " 2>/dev/null")
icount = luci.sys.exec("cat /tmp/china_ssr.txt | wc -l")
if sret == 0 and tonumber(icount) > 1000 then if sret == 0 and tonumber(icount) > 1000 then
oldcount=luci.sys.exec("cat /etc/china_ssr.txt | wc -l") oldcount = luci.sys.exec("cat /etc/china_ssr.txt | wc -l")
if tonumber(icount) ~= tonumber(oldcount) then if tonumber(icount) ~= tonumber(oldcount) then
luci.sys.exec("cp -f /tmp/china_ssr.txt /etc/china_ssr.txt") luci.sys.exec("cp -f /tmp/china_ssr.txt /etc/china_ssr.txt")
luci.sys.exec("/etc/init.d/shadowsocksr restart &") luci.sys.exec("/etc/init.d/shadowsocksr restart &")
retstring=tostring(tonumber(icount)) retstring = tostring(tonumber(icount))
else else
retstring="0" retstring = "0"
end end
else else
retstring="-1" retstring = "-1"
end end
luci.sys.exec("rm -f /tmp/china_ssr.txt") luci.sys.exec("rm -f /tmp/china_ssr.txt")
elseif set == "nfip_data" then end
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" if set == "nfip_data" then
sret=luci.sys.call(refresh_cmd .. " 2>/dev/null") 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"
icount=luci.sys.exec("cat /tmp/netflixip.list | wc -l") sret = luci.sys.call(refresh_cmd .. " 2>/dev/null")
icount = luci.sys.exec("cat /tmp/netflixip.list | wc -l")
if sret == 0 and tonumber(icount) > 5 then if sret == 0 and tonumber(icount) > 5 then
oldcount=luci.sys.exec("cat /etc/config/netflixip.list | wc -l") oldcount = luci.sys.exec("cat /etc/config/netflixip.list | wc -l")
if tonumber(icount) ~= tonumber(oldcount) then if tonumber(icount) ~= tonumber(oldcount) then
luci.sys.exec("cp -f /tmp/netflixip.list /etc/config/netflixip.list") luci.sys.exec("cp -f /tmp/netflixip.list /etc/config/netflixip.list")
luci.sys.exec("/etc/init.d/shadowsocksr restart &") luci.sys.exec("/etc/init.d/shadowsocksr restart &")
retstring=tostring(tonumber(icount)) retstring = tostring(tonumber(icount))
else else
retstring="0" retstring = "0"
end end
else else
retstring="-1" retstring = "-1"
end end
luci.sys.exec("rm -f /tmp/netflixip.list") luci.sys.exec("rm -f /tmp/netflixip.list")
else end
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" if set == "ad_data" then
sret=luci.sys.call(refresh_cmd .. " 2>/dev/null") 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"
if sret== 0 then sret = luci.sys.call(refresh_cmd .. " 2>/dev/null")
if sret == 0 then
luci.sys.call("/usr/bin/ssr-ad") luci.sys.call("/usr/bin/ssr-ad")
icount=luci.sys.exec("cat /tmp/ad.conf | wc -l") icount = luci.sys.exec("cat /tmp/ad.conf | wc -l")
if tonumber(icount) > 100 then if tonumber(icount) > 100 then
if nixio.fs.access("/etc/dnsmasq.ssr/ad.conf") then if nixio.fs.access("/etc/dnsmasq.ssr/ad.conf") then
oldcount=luci.sys.exec("cat /etc/dnsmasq.ssr/ad.conf | wc -l") oldcount = luci.sys.exec("cat /etc/dnsmasq.ssr/ad.conf | wc -l")
else else
oldcount="0" oldcount = "0"
end end
if tonumber(icount) ~= tonumber(oldcount) then if tonumber(icount) ~= tonumber(oldcount) then
luci.sys.exec("cp -f /tmp/ad.conf /etc/dnsmasq.ssr/ad.conf") luci.sys.exec("cp -f /tmp/ad.conf /etc/dnsmasq.ssr/ad.conf")
luci.sys.exec("cp -f /tmp/ad.conf /tmp/dnsmasq.ssr/ad.conf") luci.sys.exec("cp -f /tmp/ad.conf /tmp/dnsmasq.ssr/ad.conf")
luci.sys.call("/etc/init.d/dnsmasq restart") luci.sys.call("/etc/init.d/dnsmasq restart")
retstring=tostring(tonumber(icount)) retstring = tostring(tonumber(icount))
else else
retstring="0" retstring = "0"
end end
else else
retstring="-1" retstring = "-1"
end end
luci.sys.exec("rm -f /tmp/ad.conf") luci.sys.exec("rm -f /tmp/ad.conf")
else else
retstring="-1" retstring = "-1"
end end
end end
luci.http.prepare_content("application/json") luci.http.prepare_content("application/json")
luci.http.write_json({ret=retstring,retcount=icount}) luci.http.write_json({ret = retstring,retcount = icount})
end end
function check_port() function check_port()
local set="" local set = ""
local retstring="<br /><br />" local retstring = "<br /><br />"
local s local s
local server_name="" local server_name = ""
local shadowsocksr="shadowsocksr" local uci = luci.model.uci.cursor()
local uci=luci.model.uci.cursor() local iret = 1
local iret=1 uci:foreach("shadowsocksr", "servers", function(s)
uci:foreach(shadowsocksr, "servers", function(s)
if s.alias then if s.alias then
server_name=s.alias server_name = s.alias
elseif s.server and s.server_port then elseif s.server and s.server_port then
server_name="%s:%s" %{s.server, s.server_port} server_name = "%s:%s" %{s.server, s.server_port}
end end
iret=luci.sys.call(" ipset add ss_spec_wan_ac " .. s.server .. " 2>/dev/null") iret = luci.sys.call("ipset add ss_spec_wan_ac " .. s.server .. " 2>/dev/null")
socket=nixio.socket("inet", "stream") socket = nixio.socket("inet", "stream")
socket:setopt("socket", "rcvtimeo", 3) socket:setopt("socket", "rcvtimeo", 3)
socket:setopt("socket", "sndtimeo", 3) socket:setopt("socket", "sndtimeo", 3)
ret=socket:connect(s.server,s.server_port) ret = socket:connect(s.server,s.server_port)
if tostring(ret) == "true" then if tostring(ret) == "true" then
socket:close() socket:close()
retstring=retstring .. "<font color='green'>[" .. server_name .. "] OK.</font><br />" retstring = retstring .. "<font color = 'green'>[" .. server_name .. "] OK.</font><br />"
else else
retstring=retstring .. "<font color='red'>[" .. server_name .. "] Error.</font><br />" retstring = retstring .. "<font color = 'red'>[" .. server_name .. "] Error.</font><br />"
end end
if iret == 0 then if iret == 0 then
luci.sys.call(" ipset del ss_spec_wan_ac " .. s.server) luci.sys.call("ipset del ss_spec_wan_ac " .. s.server)
end end
end) end)
luci.http.prepare_content("application/json") luci.http.prepare_content("application/json")
luci.http.write_json({ret=retstring}) luci.http.write_json({ret = retstring})
end end

View File

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

View File

@ -166,12 +166,6 @@ msgstr "编辑服务器配置"
msgid "Alias" msgid "Alias"
msgstr "别名" msgstr "别名"
msgid "SOCKS Proxy"
msgstr "SOCKS(4/5)代理"
msgid "Enable SOCKS Proxy"
msgstr "启用 SOCKS 代理"
msgid "Server" msgid "Server"
msgstr "服务器" msgstr "服务器"
@ -283,6 +277,9 @@ msgstr "【国内IP段】数据库"
msgid "Netflix IP Data" msgid "Netflix IP Data"
msgstr "【Netflix IP段】数据库" msgstr "【Netflix IP段】数据库"
msgid "Advertising Data"
msgstr "【广告屏蔽】数据库"
msgid "Records" msgid "Records"
msgstr "条记录" msgstr "条记录"
@ -332,10 +329,16 @@ msgid "Enable adblock"
msgstr "启用广告屏蔽" msgstr "启用广告屏蔽"
msgid "adblock_url" msgid "adblock_url"
msgstr "广告屏蔽订阅" msgstr "广告屏蔽更新URL"
msgid "gfwlist Update url"
msgstr "GFWList更新URL"
msgid "Chnroute Update url"
msgstr "国内IP段更新URL"
msgid "nfip_url" msgid "nfip_url"
msgstr "Netflix IP更新URL" msgstr "Netflix IP更新URL"
msgid "Customize Netflix IP Url" msgid "Customize Netflix IP Url"
msgstr "自定义Netflix IP更新URL默认项目地址https://github.com/QiuSimons/Netflix_IP" 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" msgid "Enable Process Deamon"
msgstr "启用进程自动守护" msgstr "启用进程自动守护"
msgid "Advertising Data"
msgstr "【广告屏蔽】数据库"
msgid "Chnroute Setting"
msgstr "国内IP段数据库更新设置"
msgid "Update url"
msgstr "更新链接"
msgid "DNS Server IP and Port" msgid "DNS Server IP and Port"
msgstr "DNS服务器地址和端口" msgstr "DNS服务器地址和端口"
@ -496,24 +490,12 @@ msgstr "游戏模式UDP中继服务器"
msgid "Game Mode UDP Relay" msgid "Game Mode UDP Relay"
msgstr "游戏模式UDP中继" msgstr "游戏模式UDP中继"
msgid "adblock settings"
msgstr "广告屏蔽设置"
msgid "Server failsafe auto swith and custom update settings" msgid "Server failsafe auto swith and custom update settings"
msgstr "服务器节点故障自动切换/广告屏蔽/国内IP段数据库更新设置" msgstr "服务器节点故障自动切换/广告屏蔽/国内IP段数据库更新设置"
msgid "Support AdGuardHome and DNSMASQ format list" msgid "Support AdGuardHome and DNSMASQ format list"
msgstr "同时支持 AdGuard Home 和 DNSMASQ 格式的过滤列表" 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" msgid "Delete All Subscribe Severs"
msgstr "删除所有订阅服务器节点" 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_timeout '5'
option switch_time '667' option switch_time '667'
option switch_try_count '3' option switch_try_count '3'
option adblock '0' option gfwlist_url 'https://raw.githubusercontent.com/Loukky/gfwlist-by-loukky/master/gfwlist.txt'
option adblock_url 'https://gitee.com/privacy-protection-tools/anti-ad/raw/master/anti-ad-for-dnsmasq.conf'
option chnroute_url 'https://ispip.clang.cn/all_cn.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 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 netflix_server 'same'
option threads '0' option threads '0'
config socks5_proxy config socks5_proxy
option socks '0' option socks '0'
option local_port '1080' 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 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 hostip=$hostip
else else
hostip=$(cat /etc/ssr_ip) hostip=$(cat /tmp/ssr_ip)
fi fi
fi fi
[ "$2" == "0" -a "$kcp_flag" == "1" ] && hostip="127.0.0.1" [ "$2" == "0" -a "$kcp_flag" == "1" ] && hostip="127.0.0.1"
@ -179,9 +179,9 @@ start_rules() {
else else
server=$(ping $server -W 1 -s 1 -c 1 | grep PING | cut -d'(' -f 2 | cut -d')' -f1) 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 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 else
server=$(cat /etc/ssr_ip) server=$(cat /tmp/ssr_ip)
fi fi
fi fi
kcp_server=$server kcp_server=$server
@ -435,7 +435,6 @@ start_redir() {
fi fi
fi fi
if [ -n "$UDP_RELAY_SERVER" ]; then if [ -n "$UDP_RELAY_SERVER" ]; then
redir_udp=1 redir_udp=1
if [ "$utype" == "ss" -o "$utype" == "ssr" ]; then if [ "$utype" == "ss" -o "$utype" == "ssr" ]; then
@ -643,28 +642,24 @@ start() {
/usr/share/shadowsocksr/gfw2ipset.sh /usr/share/shadowsocksr/gfw2ipset.sh
if [ "$NETFLIX_SERVER" != "$GLOBAL_SERVER" ]; then if [ "$NETFLIX_SERVER" != "$GLOBAL_SERVER" ]; then
cat /etc/config/netflix.list | while read line || [ -n "$line" ]; cat /etc/config/netflix.list | while read line || [ -n "$line" ]; do
do
sed -i "/$line/d" /tmp/dnsmasq.ssr/gfw_list.conf sed -i "/$line/d" /tmp/dnsmasq.ssr/gfw_list.conf
done done
awk '!/^$/&&!/^#/{printf("ipset=/.%s/'"netflix"'\n",$0)}' /etc/config/netflix.list > /tmp/dnsmasq.ssr/netflix_forward.conf 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 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 ipset -N netflix hash:net 2>/dev/null
cat /etc/config/netflixip.list | while read nip || [ -n "$nip" ]; cat /etc/config/netflixip.list | while read nip || [ -n "$nip" ]; do
do
ipset add netflix $nip 2>/dev/null ipset add netflix $nip 2>/dev/null
done done
else else
cat /etc/config/netflix.list | while read line || [ -n "$line" ]; cat /etc/config/netflix.list | while read line || [ -n "$line" ]; do
do
sed -i "/$line/d" /tmp/dnsmasq.ssr/gfw_list.conf sed -i "/$line/d" /tmp/dnsmasq.ssr/gfw_list.conf
done done
awk '!/^$/&&!/^#/{printf("ipset=/.%s/'"netflix"'\n",$0)}' /etc/config/netflix.list > /tmp/dnsmasq.ssr/netflix_forward.conf 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 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 ipset -N netflix hash:net 2>/dev/null
cat /etc/config/netflixip.list | while read nip || [ -n "$nip" ]; cat /etc/config/netflixip.list | while read nip || [ -n "$nip" ]; do
do
ipset add netflix $nip 2>/dev/null ipset add netflix $nip 2>/dev/null
done done
fi fi
@ -739,7 +734,7 @@ stop() {
kill -9 $(busybox ps -w | grep pdnsd | grep -v grep | awk '{print $1}') >/dev/null 2>&1 kill -9 $(busybox ps -w | grep pdnsd | grep -v grep | awk '{print $1}') >/dev/null 2>&1
fi fi
if [ -f "/tmp/dnsmasq.d/dnsmasq-ssr.conf" ]; then 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 /etc/init.d/dnsmasq restart >/dev/null 2>&1
fi fi
del_cron del_cron

View File

@ -7,7 +7,7 @@ require 'nixio'
require 'luci.util' require 'luci.util'
require 'luci.jsonc' require 'luci.jsonc'
require 'luci.sys' require 'luci.sys'
local icount =0 local icount = 0
local uci = luci.model.uci.cursor() local uci = luci.model.uci.cursor()
local log = function(...) local log = function(...)
@ -15,7 +15,7 @@ local log = function(...)
end end
log('正在更新【GFW列表】数据库') 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") sret = luci.sys.call(refresh_cmd .. " 2>/dev/null")
if sret == 0 then if sret == 0 then
luci.sys.call("/usr/bin/ssr-gfw") luci.sys.call("/usr/bin/ssr-gfw")