luci-app-vssr: sync with upstream source
This commit is contained in:
parent
983bd2d46f
commit
fe56f7cdb3
@ -1,8 +1,8 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-vssr
|
||||
PKG_VERSION:=1.27
|
||||
PKG_RELEASE:=20200323-4
|
||||
PKG_VERSION:=1.29
|
||||
PKG_RELEASE:=20200325-4
|
||||
|
||||
PKG_CONFIG_DEPENDS:= CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks \
|
||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_V2ray \
|
||||
@ -89,7 +89,7 @@ config PACKAGE_$(PKG_NAME)_INCLUDE_ChinaDNS
|
||||
|
||||
config PACKAGE_$(PKG_NAME)_INCLUDE_haproxy
|
||||
bool "Include haproxy"
|
||||
default y
|
||||
default n
|
||||
|
||||
config PACKAGE_$(PKG_NAME)_INCLUDE_privoxy
|
||||
bool "Include privoxy http local"
|
||||
@ -113,11 +113,11 @@ config PACKAGE_$(PKG_NAME)_INCLUDE_udp2raw-tunnel
|
||||
|
||||
config PACKAGE_$(PKG_NAME)_INCLUDE_GoQuiet-client
|
||||
bool "Include GoQuiet-client"
|
||||
default y
|
||||
default n
|
||||
|
||||
config PACKAGE_$(PKG_NAME)_INCLUDE_GoQuiet-server
|
||||
bool "Include GoQuiet-server"
|
||||
default y
|
||||
default n
|
||||
|
||||
config PACKAGE_$(PKG_NAME)_INCLUDE_v2ray-plugin
|
||||
bool "Include v2ray-plugin"
|
||||
@ -130,7 +130,7 @@ define Package/luci-app-vssr
|
||||
SUBMENU:=3. Applications
|
||||
TITLE:=A New SS/SSR/V2Ray/Trojan LuCI interface
|
||||
PKGARCH:=all
|
||||
DEPENDS:=+shadowsocksr-libev-alt +ipset +ip-full +iptables-mod-tproxy +dnsmasq-full +coreutils +coreutils-base64 +bash +pdnsd-alt +wget +tcpping +lua-maxminddb +lua +luasocket +jshn +lua-cjson +coreutils-nohup +python3-maxminddb +curl \
|
||||
DEPENDS:=+shadowsocksr-libev-alt +ipset +ip-full +iptables-mod-tproxy +dnsmasq-full +coreutils +coreutils-base64 +bash +pdnsd-alt +wget +tcpping +lua-maxminddb +lua +luasocket +jshn +lua-cjson +coreutils-nohup +curl \
|
||||
+PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks:shadowsocks-libev-ss-redir \
|
||||
+PACKAGE_$(PKG_NAME)_INCLUDE_V2ray:v2ray \
|
||||
+PACKAGE_$(PKG_NAME)_INCLUDE_Trojan:trojan \
|
||||
@ -164,7 +164,7 @@ endef
|
||||
|
||||
define Package/luci-app-vssr/conffiles
|
||||
/etc/ssr_ip
|
||||
/etc/dnsmasq.ssr/gfw_list.conf
|
||||
/etc/dnsmasq.vssr/gfw_list.conf
|
||||
endef
|
||||
|
||||
define Package/luci-app-vssr/install
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
-- Copyright (C) 2020 yushi studio <ywb94@qq.com>
|
||||
-- Copyright (C) 2018 jerrykuku <jerrykuku@qq.com>
|
||||
-- Licensed to the public under the GNU General Public License v3.
|
||||
module("luci.controller.vssr", package.seeall)
|
||||
|
||||
@ -6,6 +6,7 @@ function index()
|
||||
if not nixio.fs.access("/etc/config/vssr") then
|
||||
return
|
||||
end
|
||||
|
||||
if nixio.fs.access("/usr/bin/ssr-redir") then
|
||||
entry({"admin", "vpn"}, firstchild(), "VPN", 45).dependent = false
|
||||
entry({"admin", "vpn", "vssr"},alias("admin", "vpn", "vssr", "client"), _("Hello World"), 10).dependent=true
|
||||
@ -40,7 +41,9 @@ end
|
||||
entry({"admin", "vpn", "vssr", "subscribe"}, call("get_subscribe"))
|
||||
entry({"admin", "vpn", "vssr", "flag"}, call("get_flag"))
|
||||
entry({"admin", "vpn", "vssr", "ip"}, call("check_ip"))
|
||||
|
||||
end
|
||||
|
||||
-- 执行订阅
|
||||
function get_subscribe()
|
||||
local cjson = require "cjson"
|
||||
@ -72,9 +75,12 @@ function get_subscribe()
|
||||
else
|
||||
e.error = 1
|
||||
end
|
||||
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(e)
|
||||
|
||||
end
|
||||
|
||||
-- 获取所有节点
|
||||
function get_servers()
|
||||
local uci = luci.model.uci.cursor()
|
||||
@ -91,6 +97,7 @@ function get_servers()
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(server_table)
|
||||
end
|
||||
|
||||
-- 切换节点
|
||||
function change_node()
|
||||
local e = {}
|
||||
@ -109,6 +116,7 @@ function change_node()
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(e)
|
||||
end
|
||||
|
||||
function switch()
|
||||
local e = {}
|
||||
local uci = luci.model.uci.cursor()
|
||||
@ -126,205 +134,213 @@ function switch()
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(e)
|
||||
end
|
||||
|
||||
|
||||
-- 检测全局服务器状态
|
||||
function act_status()
|
||||
math.randomseed(os.time())
|
||||
local e = {}
|
||||
-- 全局服务器
|
||||
e.global=luci.sys.call("ps -w | grep ssr-retcp | grep -v grep >/dev/null") == 0
|
||||
e.global=luci.sys.call("ps -w | grep ssr-retcp | grep -v grep >/dev/null") == 0
|
||||
-- 检测Socks5
|
||||
|
||||
if tonumber(luci.sys.exec("ps -w | grep ssr-local |grep -v grep| wc -l"))>0 then
|
||||
e.socks5 = true
|
||||
elseif tonumber(luci.sys.exec("ps -w | grep ss-local |grep -v grep| wc -l"))>0 then
|
||||
e.socks5 = true
|
||||
elseif tonumber(luci.sys.exec("ps -w | grep v2-ssr-local |grep -v grep| wc -l"))>0 then
|
||||
if tonumber(luci.sys.exec("ps -w | grep ssr-local |grep -v grep| wc -l"))>0 then
|
||||
e.socks5 = true
|
||||
elseif tonumber(luci.sys.exec("ps -w | grep ss-local |grep -v grep| wc -l"))>0 then
|
||||
e.socks5 = true
|
||||
elseif tonumber(luci.sys.exec("ps -w | grep v2-ssr-local |grep -v grep| wc -l"))>0 then
|
||||
end
|
||||
--检测chinadns状态
|
||||
if tonumber(luci.sys.exec("ps -w | grep chinadns |grep -v grep| wc -l"))>0 then
|
||||
e.chinadns= true
|
||||
elseif tonumber(luci.sys.exec("ps -w | grep dnsparsing |grep -v grep| wc -l"))>0 then
|
||||
e.chinadns= true
|
||||
elseif tonumber(luci.sys.exec("ps -w | grep dnscrypt-proxy |grep -v grep| wc -l"))>0 then
|
||||
e.chinadns= true
|
||||
elseif tonumber(luci.sys.exec("ps -w | grep pdnsd |grep -v grep| wc -l"))>0 then
|
||||
e.chinadns= true
|
||||
elseif tonumber(luci.sys.exec("ps -w | grep dns2socks |grep -v grep| wc -l"))>0 then
|
||||
e.chinadns= true
|
||||
elseif tonumber(luci.sys.exec("ps -w | grep dnsforwarder |grep -v grep| wc -l"))>0 then
|
||||
e.chinadns= true
|
||||
if tonumber(luci.sys.exec("ps -w | grep chinadns |grep -v grep| wc -l"))>0 then
|
||||
e.chinadns= true
|
||||
elseif tonumber(luci.sys.exec("ps -w | grep dnsparsing |grep -v grep| wc -l"))>0 then
|
||||
e.chinadns= true
|
||||
elseif tonumber(luci.sys.exec("ps -w | grep dnscrypt-proxy |grep -v grep| wc -l"))>0 then
|
||||
e.chinadns= true
|
||||
elseif tonumber(luci.sys.exec("ps -w | grep pdnsd |grep -v grep| wc -l"))>0 then
|
||||
e.chinadns= true
|
||||
elseif tonumber(luci.sys.exec("ps -w | grep dns2socks |grep -v grep| wc -l"))>0 then
|
||||
e.chinadns= true
|
||||
elseif tonumber(luci.sys.exec("ps -w | grep dnsforwarder |grep -v grep| wc -l"))>0 then
|
||||
e.chinadns= true
|
||||
end
|
||||
--检测服务端状态
|
||||
if tonumber(luci.sys.exec("ps -w | grep ssr-server |grep -v grep| wc -l"))>0 then
|
||||
e.server= true
|
||||
if tonumber(luci.sys.exec("ps -w | grep ssr-server |grep -v grep| wc -l"))>0 then
|
||||
e.server= true
|
||||
end
|
||||
if luci.sys.call("pidof ssr-server >/dev/null") == 0 then
|
||||
e.ssr_server= true
|
||||
if luci.sys.call("pidof ssr-server >/dev/null") == 0 then
|
||||
e.ssr_server= true
|
||||
end
|
||||
if luci.sys.call("pidof ss-server >/dev/null") == 0 then
|
||||
e.ss_server= true
|
||||
if luci.sys.call("pidof ss-server >/dev/null") == 0 then
|
||||
e.ss_server= true
|
||||
end
|
||||
if luci.sys.call("ps -w | grep v2ray-server | grep -v grep >/dev/null") == 0 then
|
||||
e.v2_server= true
|
||||
end
|
||||
-- 检测国内通道
|
||||
e.baidu = false
|
||||
sret = luci.sys.call("/usr/bin/ssr-check www.baidu.com 80 3 1")
|
||||
if sret == 0 then
|
||||
e.baidu = true
|
||||
end
|
||||
-- 检测国外通道
|
||||
e.google = false
|
||||
sret = luci.sys.call("/usr/bin/ssr-check www.google.com 80 3 1")
|
||||
if sret == 0 then
|
||||
e.google = true
|
||||
end
|
||||
-- 检测游戏模式状态
|
||||
e.game = false
|
||||
if tonumber(luci.sys.exec("ps -w | grep ssr-reudp |grep -v grep| wc -l"))>0 then
|
||||
e.game= true
|
||||
else
|
||||
if tonumber(luci.sys.exec("ps -w | grep ssr-retcp |grep \"\\-u\"|grep -v grep| wc -l"))>0 then
|
||||
e.game= true
|
||||
end
|
||||
end
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(e)
|
||||
if luci.sys.call("ps -w | grep v2ray-server | grep -v grep >/dev/null") == 0 then
|
||||
e.v2_server= true
|
||||
|
||||
end
|
||||
|
||||
-- 检测国内通道
|
||||
e.baidu = false
|
||||
sret = luci.sys.call("/usr/bin/ssr-check www.baidu.com 80 3 1")
|
||||
if sret == 0 then
|
||||
e.baidu = true
|
||||
end
|
||||
|
||||
-- 检测国外通道
|
||||
e.google = false
|
||||
sret = luci.sys.call("/usr/bin/ssr-check www.google.com 80 3 1")
|
||||
if sret == 0 then
|
||||
e.google = true
|
||||
end
|
||||
|
||||
|
||||
-- 检测游戏模式状态
|
||||
e.game = false
|
||||
if tonumber(luci.sys.exec("ps -w | grep ssr-reudp |grep -v grep| wc -l"))>0 then
|
||||
e.game= true
|
||||
else
|
||||
if tonumber(luci.sys.exec("ps -w | grep ssr-retcp |grep \"\\-u\"|grep -v grep| wc -l"))>0 then
|
||||
e.game= true
|
||||
end
|
||||
end
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(e)
|
||||
end
|
||||
function act_ping()
|
||||
local e = {}
|
||||
local domain = luci.http.formvalue("domain")
|
||||
local port = luci.http.formvalue("port")
|
||||
e.index = luci.http.formvalue("index")
|
||||
local iret = luci.sys.call(" ipset add ss_spec_wan_ac " .. domain .. " 2>/dev/null")
|
||||
local socket = nixio.socket("inet", "stream")
|
||||
socket:setopt("socket", "rcvtimeo", 3)
|
||||
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))
|
||||
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
|
||||
if (iret == 0) then
|
||||
luci.sys.call(" ipset del ss_spec_wan_ac " .. domain)
|
||||
end
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(e)
|
||||
local e = {}
|
||||
local domain = luci.http.formvalue("domain")
|
||||
local port = luci.http.formvalue("port")
|
||||
e.index = luci.http.formvalue("index")
|
||||
local iret = luci.sys.call(" ipset add ss_spec_wan_ac " .. domain .. " 2>/dev/null")
|
||||
local socket = nixio.socket("inet", "stream")
|
||||
socket:setopt("socket", "rcvtimeo", 3)
|
||||
socket:setopt("socket", "sndtimeo", 3)
|
||||
e.socket = socket:connect(domain, port)
|
||||
socket:close()
|
||||
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)
|
||||
if (e.ping == "") then
|
||||
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))
|
||||
end
|
||||
if (iret == 0) then
|
||||
luci.sys.call(" ipset del ss_spec_wan_ac " .. domain)
|
||||
end
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(e)
|
||||
end
|
||||
function check_status()
|
||||
local set ="/usr/bin/ssr-check www." .. luci.http.formvalue("set") .. ".com 80 3 1"
|
||||
sret=luci.sys.call(set)
|
||||
if sret== 0 then
|
||||
retstring ="0"
|
||||
else
|
||||
retstring ="1"
|
||||
end
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json({ ret=retstring })
|
||||
local set ="/usr/bin/ssr-check www." .. luci.http.formvalue("set") .. ".com 80 3 1"
|
||||
sret=luci.sys.call(set)
|
||||
if sret== 0 then
|
||||
retstring ="0"
|
||||
else
|
||||
retstring ="1"
|
||||
end
|
||||
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json({ ret=retstring })
|
||||
end
|
||||
|
||||
-- 刷新检测文件
|
||||
function refresh_data()
|
||||
local set =luci.http.formvalue("set")
|
||||
local icount =0
|
||||
function refresh_data()
|
||||
local set =luci.http.formvalue("set")
|
||||
local icount =0
|
||||
|
||||
if set == "gfw_data" then
|
||||
refresh_cmd="wget-ssl --no-check-certificate https://cdn.jsdelivr.net/gh/gfwlist/gfwlist/gfwlist.txt -O /tmp/gfw.b64"
|
||||
sret=luci.sys.call(refresh_cmd .. " 2>/dev/null")
|
||||
if sret== 0 then
|
||||
luci.sys.call("/usr/bin/vssr-gfw")
|
||||
icount = luci.sys.exec("cat /tmp/gfwnew.txt | wc -l")
|
||||
if tonumber(icount)>1000 then
|
||||
oldcount=luci.sys.exec("cat /etc/dnsmasq.ssr/gfw_list.conf | wc -l")
|
||||
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 /tmp/dnsmasq.ssr/gfw_list.conf")
|
||||
luci.sys.call("/etc/init.d/dnsmasq restart")
|
||||
retstring=tostring(math.ceil(tonumber(icount)/2))
|
||||
else
|
||||
retstring ="0"
|
||||
if set == "gfw_data" then
|
||||
refresh_cmd="wget-ssl --no-check-certificate https://cdn.jsdelivr.net/gh/gfwlist/gfwlist/gfwlist.txt -O /tmp/gfw.b64"
|
||||
sret=luci.sys.call(refresh_cmd .. " 2>/dev/null")
|
||||
if sret== 0 then
|
||||
luci.sys.call("/usr/bin/vssr-gfw")
|
||||
icount = luci.sys.exec("cat /tmp/gfwnew.txt | wc -l")
|
||||
if tonumber(icount)>1000 then
|
||||
oldcount=luci.sys.exec("cat /etc/dnsmasq.vssr/gfw_list.conf | wc -l")
|
||||
if tonumber(icount) ~= tonumber(oldcount) then
|
||||
luci.sys.exec("cp -f /tmp/gfwnew.txt /etc/dnsmasq.vssr/gfw_list.conf")
|
||||
luci.sys.exec("cp -f /tmp/gfwnew.txt /tmp/dnsmasq.vssr/gfw_list.conf")
|
||||
luci.sys.call("/etc/init.d/dnsmasq restart")
|
||||
retstring=tostring(math.ceil(tonumber(icount)/2))
|
||||
else
|
||||
retstring ="0"
|
||||
end
|
||||
else
|
||||
retstring ="-1"
|
||||
else
|
||||
retstring ="-1"
|
||||
end
|
||||
luci.sys.exec("rm -f /tmp/gfwnew.txt ")
|
||||
else
|
||||
retstring ="-1"
|
||||
luci.sys.exec("rm -f /tmp/gfwnew.txt ")
|
||||
else
|
||||
retstring ="-1"
|
||||
end
|
||||
elseif set == "ip_data" then
|
||||
if (luci.model.uci.cursor():get_first('vssr', 'global', 'chnroute', '0') == '1') then
|
||||
refresh_cmd="wget-ssl --no-check-certificate -O - " .. luci.model.uci.cursor():get_first('vssr', 'global', 'chnroute_url', 'https://ispip.clang.cn/all_cn.txt') .. ' > /tmp/china_ssr.txt 2>/dev/null'
|
||||
else
|
||||
refresh_cmd="wget -O- 'http://ftp.apnic.net/apnic/stats/apnic/delegated-apnic-latest' 2>/dev/null| awk -F\\| '/CN\\|ipv4/ { printf(\"%s/%d\\n\", $4, 32-log($5)/log(2)) }' > /tmp/china_ssr.txt"
|
||||
elseif set == "ip_data" then
|
||||
if (luci.model.uci.cursor():get_first('vssr', 'global', 'chnroute', '0') == '1') then
|
||||
refresh_cmd="wget-ssl --no-check-certificate -O - " .. luci.model.uci.cursor():get_first('vssr', 'global', 'chnroute_url', 'https://ispip.clang.cn/all_cn.txt') .. ' > /tmp/china_ssr.txt 2>/dev/null'
|
||||
else
|
||||
refresh_cmd="wget -O- 'http://ftp.apnic.net/apnic/stats/apnic/delegated-apnic-latest' 2>/dev/null| awk -F\\| '/CN\\|ipv4/ { printf(\"%s/%d\\n\", $4, 32-log($5)/log(2)) }' > /tmp/china_ssr.txt"
|
||||
end
|
||||
sret=luci.sys.call(refresh_cmd)
|
||||
icount = luci.sys.exec("cat /tmp/china_ssr.txt | wc -l")
|
||||
if sret== 0 and tonumber(icount)>1000 then
|
||||
oldcount=luci.sys.exec("cat /etc/china_ssr.txt | wc -l")
|
||||
if tonumber(icount) ~= tonumber(oldcount) then
|
||||
luci.sys.exec("cp -f /tmp/china_ssr.txt /etc/china_ssr.txt")
|
||||
retstring=tostring(tonumber(icount))
|
||||
else
|
||||
retstring ="0"
|
||||
end
|
||||
else
|
||||
retstring ="-1"
|
||||
end
|
||||
luci.sys.exec("rm -f /tmp/china_ssr.txt ")
|
||||
else
|
||||
if nixio.fs.access("/usr/bin/wget-ssl") then
|
||||
refresh_cmd="wget-ssl --no-check-certificate -O - ".. luci.model.uci.cursor():get_first('vssr', 'global', 'adblock_url','https://easylist-downloads.adblockplus.org/easylistchina+easylist.txt') .." > /tmp/adnew.conf"
|
||||
end
|
||||
sret=luci.sys.call(refresh_cmd)
|
||||
icount = luci.sys.exec("cat /tmp/china_ssr.txt | wc -l")
|
||||
if sret== 0 and tonumber(icount)>1000 then
|
||||
oldcount=luci.sys.exec("cat /etc/china_ssr.txt | wc -l")
|
||||
if tonumber(icount) ~= tonumber(oldcount) then
|
||||
luci.sys.exec("cp -f /tmp/china_ssr.txt /etc/china_ssr.txt")
|
||||
retstring=tostring(tonumber(icount))
|
||||
else
|
||||
retstring ="0"
|
||||
end
|
||||
else
|
||||
retstring ="-1"
|
||||
end
|
||||
luci.sys.exec("rm -f /tmp/china_ssr.txt ")
|
||||
else
|
||||
if nixio.fs.access("/usr/bin/wget-ssl") then
|
||||
refresh_cmd="wget-ssl --no-check-certificate -O - ".. luci.model.uci.cursor():get_first('vssr', 'global', 'adblock_url','https://easylist-downloads.adblockplus.org/easylistchina+easylist.txt') .." > /tmp/adnew.conf"
|
||||
end
|
||||
sret=luci.sys.call(refresh_cmd .. " 2>/dev/null")
|
||||
if sret== 0 then
|
||||
luci.sys.call("/usr/bin/vssr-ad")
|
||||
icount = luci.sys.exec("cat /tmp/ad.conf | wc -l")
|
||||
if tonumber(icount)>1000 then
|
||||
if nixio.fs.access("/etc/dnsmasq.ssr/ad.conf") then
|
||||
oldcount=luci.sys.exec("cat /etc/dnsmasq.ssr/ad.conf | wc -l")
|
||||
else
|
||||
oldcount=0
|
||||
end
|
||||
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 /tmp/dnsmasq.ssr/ad.conf")
|
||||
luci.sys.call("/etc/init.d/dnsmasq restart")
|
||||
retstring=tostring(math.ceil(tonumber(icount)))
|
||||
else
|
||||
retstring ="0"
|
||||
end
|
||||
else
|
||||
retstring ="-1"
|
||||
end
|
||||
luci.sys.exec("rm -f /tmp/ad.conf")
|
||||
else
|
||||
retstring ="-1"
|
||||
sret=luci.sys.call(refresh_cmd .. " 2>/dev/null")
|
||||
if sret== 0 then
|
||||
luci.sys.call("/usr/bin/vssr-ad")
|
||||
icount = luci.sys.exec("cat /tmp/ad.conf | wc -l")
|
||||
if tonumber(icount)>1000 then
|
||||
if nixio.fs.access("/etc/dnsmasq.vssr/ad.conf") then
|
||||
oldcount=luci.sys.exec("cat /etc/dnsmasq.vssr/ad.conf | wc -l")
|
||||
else
|
||||
oldcount=0
|
||||
end
|
||||
if tonumber(icount) ~= tonumber(oldcount) then
|
||||
luci.sys.exec("cp -f /tmp/ad.conf /etc/dnsmasq.vssr/ad.conf")
|
||||
luci.sys.exec("cp -f /tmp/ad.conf /tmp/dnsmasq.vssr/ad.conf")
|
||||
luci.sys.call("/etc/init.d/dnsmasq restart")
|
||||
retstring=tostring(math.ceil(tonumber(icount)))
|
||||
else
|
||||
retstring ="0"
|
||||
end
|
||||
else
|
||||
retstring ="-1"
|
||||
end
|
||||
luci.sys.exec("rm -f /tmp/ad.conf")
|
||||
else
|
||||
retstring ="-1"
|
||||
end
|
||||
end
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json({ ret=retstring ,retcount=icount})
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json({ ret=retstring ,retcount=icount})
|
||||
end
|
||||
|
||||
-- 检测所有服务器
|
||||
function check_ports()
|
||||
local set = ""
|
||||
local retstring = "<br /><br />"
|
||||
local s
|
||||
local server_name = ""
|
||||
local vssr = "vssr"
|
||||
local uci = luci.model.uci.cursor()
|
||||
local iret = 1
|
||||
uci:foreach(
|
||||
vssr,
|
||||
"servers",
|
||||
function(s)
|
||||
if s.alias then
|
||||
function check_ports()
|
||||
local set = ""
|
||||
local retstring = "<br /><br />"
|
||||
local s
|
||||
local server_name = ""
|
||||
local vssr = "vssr"
|
||||
local uci = luci.model.uci.cursor()
|
||||
local iret = 1
|
||||
|
||||
uci:foreach(
|
||||
vssr,
|
||||
"servers",
|
||||
function(s)
|
||||
if s.alias then
|
||||
server_name = s.alias
|
||||
elseif s.server and s.server_port then
|
||||
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")
|
||||
socket = nixio.socket("inet", "stream")
|
||||
socket:setopt("socket", "rcvtimeo", 3)
|
||||
@ -402,18 +418,18 @@ end
|
||||
|
||||
-- 检测 当前节点ip 和 网站访问情况
|
||||
function check_ip()
|
||||
-- 获取当前的ip和国家
|
||||
local e = {}
|
||||
http = require("socket.http")
|
||||
http.TIMEOUT = 1
|
||||
|
||||
result = luci.sys.exec("curl -s https://api.ip.sb/ip")
|
||||
if JudgeIPString(result) then
|
||||
local cmd = '/usr/share/vssr/getip.sh '..result
|
||||
e.outboard = result
|
||||
e.outboardip = luci.sys.exec(cmd)
|
||||
else
|
||||
e.outboard = false
|
||||
end
|
||||
local d = {}
|
||||
local mm = require 'maxminddb'
|
||||
local db = mm.open('/usr/share/vssr/GeoLite2-Country.mmdb')
|
||||
local ip = string.gsub(luci.sys.exec("curl -s https://api.ip.sb/ip"), "\n", "")
|
||||
local res = db:lookup(ip)
|
||||
d.flag = string.lower(res:get("country", "iso_code"))
|
||||
d.country = res:get("country", "names", "zh-CN")
|
||||
e.outboard = ip
|
||||
e.outboardip = d
|
||||
|
||||
-- 检测国内通道
|
||||
e.baidu = false
|
||||
sret1 = luci.sys.call("/usr/bin/ssr-check www.baidu.com 80 3 1")
|
||||
@ -441,22 +457,22 @@ function get_flag()
|
||||
local e = {}
|
||||
local host = luci.http.formvalue("host")
|
||||
local remark = luci.http.formvalue("remark")
|
||||
local cmd1 = '/usr/share/vssr/getflag.sh "' .. remark .. '" ' .. host
|
||||
local cmd = '/usr/share/vssr/getflag.sh "' .. remark .. '" ' .. host
|
||||
e.host = host
|
||||
e.flag = luci.sys.exec(cmd1)
|
||||
e.flag = luci.sys.exec(cmd)
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(e)
|
||||
end
|
||||
|
||||
function act_read(lfile)
|
||||
local NXFS = require "nixio.fs"
|
||||
local HTTP = require "luci.http"
|
||||
local lfile = HTTP.formvalue("lfile")
|
||||
local ldata={}
|
||||
ldata[#ldata+1] = NXFS.readfile(lfile) or "_nofile_"
|
||||
if ldata[1] == "" then
|
||||
local NXFS = require "nixio.fs"
|
||||
local HTTP = require "luci.http"
|
||||
local lfile = HTTP.formvalue("lfile")
|
||||
local ldata={}
|
||||
ldata[#ldata+1] = NXFS.readfile(lfile) or "_nofile_"
|
||||
if ldata[1] == "" then
|
||||
ldata[1] = "_nodata_"
|
||||
end
|
||||
HTTP.prepare_content("application/json")
|
||||
HTTP.write_json(ldata)
|
||||
HTTP.prepare_content("application/json")
|
||||
HTTP.write_json(ldata)
|
||||
end
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
local fs = require "nixio.fs"
|
||||
local conffile = "/etc/dnsmasq.ssr/appoint_list.conf"
|
||||
local conffile = "/etc/dnsmasq.vssr/appoint_list.conf"
|
||||
|
||||
f = SimpleForm("custom", translate("Appoint dns List"))
|
||||
|
||||
|
||||
@ -9,7 +9,7 @@ local ad_count=0
|
||||
local ip_count=0
|
||||
local gfwmode=0
|
||||
|
||||
if nixio.fs.access("/etc/dnsmasq.ssr/gfw_list.conf") then
|
||||
if nixio.fs.access("/etc/dnsmasq.vssr/gfw_list.conf") then
|
||||
gfwmode=1
|
||||
end
|
||||
|
||||
@ -18,9 +18,9 @@ local uci = luci.model.uci.cursor()
|
||||
local sys = require "luci.sys"
|
||||
|
||||
if gfwmode==1 then
|
||||
gfw_count = tonumber(sys.exec("cat /etc/dnsmasq.ssr/gfw_list.conf | wc -l"))/2
|
||||
if nixio.fs.access("/etc/dnsmasq.ssr/ad.conf") then
|
||||
ad_count=tonumber(sys.exec("cat /etc/dnsmasq.ssr/ad.conf | wc -l"))
|
||||
gfw_count = tonumber(sys.exec("cat /etc/dnsmasq.vssr/gfw_list.conf | wc -l"))/2
|
||||
if nixio.fs.access("/etc/dnsmasq.vssr/ad.conf") then
|
||||
ad_count=tonumber(sys.exec("cat /etc/dnsmasq.vssr/ad.conf | wc -l"))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
-- Copyright (C) 2017 yushi studio <ywb94@qq.com>
|
||||
-- Licensed to the public under the GNU General Public License v3.
|
||||
|
||||
local IPK_Version="20200323.1.27"
|
||||
local IPK_Version="20200325.1.29"
|
||||
local m, s, o
|
||||
local redir_run=0
|
||||
local reudp_run=0
|
||||
@ -27,7 +27,7 @@ local dns2socks_run=0
|
||||
local haproxy_run=0
|
||||
local privoxy_run=0
|
||||
|
||||
if nixio.fs.access("/etc/dnsmasq.ssr/gfw_list.conf") then
|
||||
if nixio.fs.access("/etc/dnsmasq.vssr/gfw_list.conf") then
|
||||
gfwmode=1
|
||||
end
|
||||
|
||||
@ -87,9 +87,9 @@ else
|
||||
end
|
||||
|
||||
if gfwmode==1 then
|
||||
gfw_count = tonumber(sys.exec("cat /etc/dnsmasq.ssr/gfw_list.conf | wc -l"))/2
|
||||
if nixio.fs.access("/etc/dnsmasq.ssr/ad.conf") then
|
||||
ad_count=tonumber(sys.exec("cat /etc/dnsmasq.ssr/ad.conf | wc -l"))
|
||||
gfw_count = tonumber(sys.exec("cat /etc/dnsmasq.vssr/gfw_list.conf | wc -l"))/2
|
||||
if nixio.fs.access("/etc/dnsmasq.vssr/ad.conf") then
|
||||
ad_count=tonumber(sys.exec("cat /etc/dnsmasq.vssr/ad.conf | wc -l"))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -8,7 +8,7 @@ local gfwmode=0
|
||||
local gfw_count=0
|
||||
local ip_count=0
|
||||
|
||||
if nixio.fs.access("/etc/dnsmasq.ssr/gfw_list.conf") then
|
||||
if nixio.fs.access("/etc/dnsmasq.vssr/gfw_list.conf") then
|
||||
gfwmode=1
|
||||
end
|
||||
|
||||
@ -22,7 +22,7 @@ local fs = require "nixio.fs"
|
||||
local sys = require "luci.sys"
|
||||
|
||||
if gfwmode==1 then
|
||||
gfw_count = tonumber(sys.exec("cat /etc/dnsmasq.ssr/gfw_list.conf | wc -l"))/2
|
||||
gfw_count = tonumber(sys.exec("cat /etc/dnsmasq.vssr/gfw_list.conf | wc -l"))/2
|
||||
|
||||
end
|
||||
|
||||
|
||||
@ -90,8 +90,7 @@ math.randomseed(os.time())
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const $$ = document;
|
||||
|
||||
const VSSR_ASSETS = '/luci-static/vssr/';
|
||||
function get_state(){
|
||||
$.get('<%=url([[admin]], [[vpn]], [[vssr]], [[run]])%>',
|
||||
function (data) {
|
||||
|
||||
@ -1,100 +1,67 @@
|
||||
<%
|
||||
math.randomseed(os.time())
|
||||
-%>
|
||||
<html>
|
||||
|
||||
<body>
|
||||
<div class="status-bar">
|
||||
<div class="inner">
|
||||
<div class="pure-g">
|
||||
<div class="pure-u-1-2">
|
||||
<span class="flag"><img src="/luci-static/vssr/flags/4x3/un.svg" class="pure-img"></span> <span
|
||||
class="status-info"></span>
|
||||
</div>
|
||||
<div class="pure-u-1-2">
|
||||
<div class="icon-con">
|
||||
<img src="/luci-static/vssr/img/site_icon1_01.png" class="pure-img i1">
|
||||
<img src="/luci-static/vssr/img/site_icon1_02.png" class="pure-img i2">
|
||||
<img src="/luci-static/vssr/img/site_icon1_03.png" class="pure-img i3">
|
||||
<img src="/luci-static/vssr/img/site_icon1_04.png" class="pure-img i4">
|
||||
</div>
|
||||
<div class="status-bar">
|
||||
<div class="inner">
|
||||
<div class="pure-g">
|
||||
<div class="pure-u-1-2">
|
||||
<span class="flag"><img src="/luci-static/vssr/flags/4x3/un.svg" class="pure-img"></span> <span
|
||||
class="status-info">获取中...</span>
|
||||
</div>
|
||||
<div class="pure-u-1-2">
|
||||
<div class="icon-con">
|
||||
<img src="/luci-static/vssr/img/site_icon1_01.png" class="pure-img i1">
|
||||
<img src="/luci-static/vssr/img/site_icon1_02.png" class="pure-img i2">
|
||||
<img src="/luci-static/vssr/img/site_icon1_03.png" class="pure-img i3">
|
||||
<img src="/luci-static/vssr/img/site_icon1_04.png" class="pure-img i4">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
var wW = $(window).width();
|
||||
<script>
|
||||
|
||||
function resize() {
|
||||
wW = $(window).width();
|
||||
lw = $(".main-left").width()
|
||||
$(".status-bar").width(wW - lw);
|
||||
$(".status-bar .flag").width($(".status-bar .flag").height() / 3 * 4);
|
||||
}
|
||||
$(window).resize(resize);
|
||||
$(document).ready(function () {
|
||||
resize();
|
||||
$.getJSON("<%=url([[admin]], [[vpn]], [[vssr]], [[ip]])%>", function (data) {
|
||||
wirte_status(data);
|
||||
});
|
||||
XHR.poll(5, '<%=url([[admin]], [[vpn]], [[vssr]], [[ip]])%>', null,
|
||||
function (x, data) {
|
||||
wirte_status(data);
|
||||
}
|
||||
);
|
||||
const CHECK_IP_URL = '<%=url([[admin]], [[vpn]], [[vssr]], [[ip]])%>';
|
||||
var wW = $(window).width();
|
||||
|
||||
function wirte_status(data) {
|
||||
if(data.outboard){
|
||||
json = data.outboardip.replace(/[\r\n]/g,"");
|
||||
json = eval("(" + json + ")");
|
||||
if(json.flag == "tw"){
|
||||
flag = "cn";
|
||||
country = "中国"
|
||||
}else{
|
||||
flag = json.flag;
|
||||
country = json.country;
|
||||
}
|
||||
$(".flag img").attr("src","/luci-static/vssr/flags/4x3/"+flag+".svg");
|
||||
|
||||
$(".status-info").html(data.outboard+"<br>"+country);
|
||||
}
|
||||
if(data.baidu){
|
||||
$(".i1").attr("src","/luci-static/vssr/img/site_icon_01.png");
|
||||
}else{
|
||||
$(".i1").attr("src","/luci-static/vssr/img/site_icon1_01.png");
|
||||
}
|
||||
function resize() {
|
||||
wW = $(window).width();
|
||||
lw = $(".main-left").width()
|
||||
$(".status-bar").width(wW - lw);
|
||||
$(".status-bar .flag").width($(".status-bar .flag").height() / 3 * 4);
|
||||
|
||||
if(data.taobao){
|
||||
$(".i2").attr("src","/luci-static/vssr/img/site_icon_02.png");
|
||||
}else{
|
||||
$(".i2").attr("src","/luci-static/vssr/img/site_icon1_02.png");
|
||||
}
|
||||
|
||||
if(data.google){
|
||||
$(".i3").attr("src","/luci-static/vssr/img/site_icon_03.png");
|
||||
}else{
|
||||
$(".i3").attr("src","/luci-static/vssr/img/site_icon1_03.png");
|
||||
}
|
||||
|
||||
if(data.youtube){
|
||||
$(".i4").attr("src","/luci-static/vssr/img/site_icon_04.png");
|
||||
}else{
|
||||
$(".i4").attr("src","/luci-static/vssr/img/site_icon1_04.png");
|
||||
}
|
||||
|
||||
|
||||
$(".flag-icon").each(function (index, el) {
|
||||
if ($(el).height < 60) {
|
||||
$(el).parent.height(60);
|
||||
$(el).width(60)
|
||||
} else {
|
||||
$(el).width($(el).height());
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
function wirte_status(data) {
|
||||
if (data.outboard) {
|
||||
json = data.outboardip;
|
||||
country = (json.flag == "tw") ? "中国 台湾" : json.country;
|
||||
$(".flag img").attr("src", VSSR_ASSETS + "flags/4x3/" + json.flag + ".svg");
|
||||
$(".status-info").html(data.outboard + "<br>" + country);
|
||||
}
|
||||
data.baidu ? $(".i1").attr("src", VSSR_ASSETS + "img/site_icon_01.png") : $(".i1").attr("src", VSSR_ASSETS + "img/site_icon1_01.png");
|
||||
data.taobao ? $(".i2").attr("src", VSSR_ASSETS + "img/site_icon_02.png") : $(".i2").attr("src", VSSR_ASSETS + "img/site_icon1_02.png");
|
||||
data.google ? $(".i3").attr("src", VSSR_ASSETS + "img/site_icon_03.png") : $(".i3").attr("src", VSSR_ASSETS + "img/site_icon1_03.png");
|
||||
data.youtube ? $(".i4").attr("src", VSSR_ASSETS + "img/site_icon_04.png") : $(".i4").attr("src", VSSR_ASSETS + "img/site_icon1_04.png");
|
||||
}
|
||||
XHR.poll(5, CHECK_IP_URL, null,
|
||||
function (x, data) {
|
||||
wirte_status(data);
|
||||
}
|
||||
);
|
||||
|
||||
$(document).ready(function () {
|
||||
resize();
|
||||
$.getJSON(CHECK_IP_URL, wirte_status);
|
||||
});
|
||||
|
||||
$(window).resize(resize);
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
</script>
|
||||
|
||||
@ -1878,7 +1878,8 @@
|
||||
101.16.0.0/12
|
||||
101.33.128.0/17
|
||||
101.34.0.0/15
|
||||
101.36.0.0/17
|
||||
101.36.0.0/18
|
||||
101.36.64.0/19
|
||||
101.36.128.0/17
|
||||
101.37.0.0/16
|
||||
101.38.0.0/15
|
||||
@ -3995,6 +3996,14 @@
|
||||
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.149.181.0/24
|
||||
103.149.190.0/23
|
||||
103.149.210.0/23
|
||||
103.149.214.0/23
|
||||
103.192.0.0/22
|
||||
103.192.4.0/22
|
||||
103.192.8.0/22
|
||||
@ -4084,7 +4093,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
|
||||
@ -5430,13 +5438,11 @@
|
||||
118.24.0.0/15
|
||||
118.26.0.0/19
|
||||
118.26.32.0/22
|
||||
118.26.36.0/22
|
||||
118.26.40.0/21
|
||||
118.26.48.0/21
|
||||
118.26.56.0/21
|
||||
118.26.64.0/19
|
||||
118.26.96.0/21
|
||||
118.26.104.0/21
|
||||
118.26.112.0/21
|
||||
118.26.120.0/21
|
||||
118.26.128.0/17
|
||||
@ -5492,12 +5498,14 @@
|
||||
118.192.0.0/16
|
||||
118.193.0.0/21
|
||||
118.193.8.0/21
|
||||
118.193.32.0/19
|
||||
118.193.64.0/20
|
||||
118.193.48.0/21
|
||||
118.193.96.0/19
|
||||
118.193.128.0/17
|
||||
118.194.0.0/17
|
||||
118.194.128.0/17
|
||||
118.194.128.0/18
|
||||
118.194.192.0/19
|
||||
118.194.224.0/22
|
||||
118.194.240.0/21
|
||||
118.195.0.0/17
|
||||
118.195.128.0/17
|
||||
118.196.0.0/14
|
||||
@ -5751,7 +5759,6 @@
|
||||
123.58.64.0/19
|
||||
123.58.96.0/19
|
||||
123.58.128.0/18
|
||||
123.58.192.0/19
|
||||
123.58.224.0/20
|
||||
123.58.240.0/20
|
||||
123.59.0.0/16
|
||||
@ -6162,7 +6169,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
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -992,19 +992,19 @@ start() {
|
||||
fi
|
||||
if rules; then
|
||||
start_redir
|
||||
mkdir -p /tmp/dnsmasq.d && cp -a /etc/dnsmasq.ssr /tmp/ && cp -a /etc/dnsmasq.oversea /tmp/
|
||||
mkdir -p /tmp/dnsmasq.d && cp -a /etc/dnsmasq.vssr /tmp/ && cp -a /etc/dnsmasq.d/tmp/
|
||||
if ! [ "$run_mode" == "oversea" ]; then
|
||||
cat <<-EOF >/tmp/dnsmasq.d/dnsmasq-ssr.conf
|
||||
conf-dir=/tmp/dnsmasq.ssr
|
||||
conf-dir=/tmp/dnsmasq.vssr
|
||||
EOF
|
||||
else
|
||||
cat <<-EOF >/tmp/dnsmasq.d/dnsmasq-ssr.conf
|
||||
conf-dir=/tmp/dnsmasq.oversea
|
||||
conf-dir=/tmp/dnsmasq.d
|
||||
|
||||
else
|
||||
mkdir -p /var/etc/dnsmasq.oversea
|
||||
ln -s /etc/dnsmasq.oversea/* /var/etc/dnsmasq.oversea/
|
||||
ln -s /etc/dnsmasq.ssr/appoint_list.conf /var/etc/dnsmasq.oversea/appoint_list.conf
|
||||
mkdir -p /var/etc/dnsmasq.d
|
||||
ln -s /etc/dnsmasq.d/* /var/etc/dnsmasq.d/
|
||||
ln -s /etc/dnsmasq.vssr/appoint_list.conf /var/etc/dnsmasq.d/appoint_list.conf
|
||||
|
||||
EOF
|
||||
fi
|
||||
@ -1012,7 +1012,7 @@ start() {
|
||||
rm -f /tmp/dnsmasq.d/ad.conf
|
||||
fi
|
||||
if [ $(uci_get_by_type global adblock 0) == "0" ]; then
|
||||
rm -f /tmp/dnsmasq.ssr/ad.conf
|
||||
rm -f /tmp/dnsmasq.vssr/ad.conf
|
||||
fi
|
||||
/usr/share/vssr/gfw2ipset.sh
|
||||
/etc/init.d/dnsmasq restart >/dev/null 2>&1
|
||||
@ -1062,16 +1062,15 @@ stop() {
|
||||
killall -q -9 haproxy
|
||||
killall -q -9 privoxy
|
||||
killall -q -9 ipt2socks
|
||||
killall -q -9 dns2socks
|
||||
killall -q -9 dns2socks
|
||||
killall -q -9 v2ray-plugin
|
||||
killall -q -9 gq-client
|
||||
killall -q -9 dnscrypt-proxy
|
||||
killall -q -9 dnsforwarder
|
||||
killall -q -9 gq-server
|
||||
killall -q -9 obfs-local
|
||||
killall -q -9 obfs-server
|
||||
killall -q -9 chinadns
|
||||
killall -q -9 dnscrypt-proxy
|
||||
killall -q -9 dnsforwarder
|
||||
killall -q -9 pdnsd
|
||||
killall -q -9 udp2raw
|
||||
killall -q -9 udpspeeder
|
||||
if [ -f /var/run/pdnsd.pid ]; then
|
||||
@ -1082,7 +1081,7 @@ stop() {
|
||||
if [ $(uci_get_by_type global adblock 0) == "0" ]; then
|
||||
rm -f /tmp/dnsmasq.d/ad.conf
|
||||
else
|
||||
cp -f /etc/dnsmasq.ssr/ad.conf /tmp/dnsmasq.d/ad.conf
|
||||
cp -f /etc/dnsmasq.vssr/ad.conf /tmp/dnsmasq.d/ad.conf
|
||||
fi
|
||||
if [ -f "/tmp/dnsmasq.d/dnsmasq-ssr.conf" ]; then
|
||||
rm -f /tmp/dnsmasq.d/dnsmasq-ssr.conf
|
||||
|
||||
@ -1,11 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
mkdir -p /tmp/dnsmasq.ssr
|
||||
mkdir -p /tmp/dnsmasq.vssr
|
||||
|
||||
awk '!/^$/&&!/^#/{printf("ipset=/.%s/'"gfwlist"'\n",$0)}' /etc/config/gfw.list > /tmp/dnsmasq.ssr/custom_forward.conf
|
||||
awk '!/^$/&&!/^#/{printf("server=/.%s/'"127.0.0.1#5335"'\n",$0)}' /etc/config/gfw.list >> /tmp/dnsmasq.ssr/custom_forward.conf
|
||||
awk '!/^$/&&!/^#/{printf("ipset=/.%s/'"gfwlist"'\n",$0)}' /etc/config/gfw.list > /tmp/dnsmasq.vssr/custom_forward.conf
|
||||
awk '!/^$/&&!/^#/{printf("server=/.%s/'"127.0.0.1#5335"'\n",$0)}' /etc/config/gfw.list >> /tmp/dnsmasq.vssr/custom_forward.conf
|
||||
|
||||
awk '!/^$/&&!/^#/{printf("ipset=/.%s/'"blacklist"'\n",$0)}' /etc/config/black.list > /tmp/dnsmasq.ssr/blacklist_forward.conf
|
||||
awk '!/^$/&&!/^#/{printf("server=/.%s/'"127.0.0.1#5335"'\n",$0)}' /etc/config/black.list >> /tmp/dnsmasq.ssr/blacklist_forward.conf
|
||||
awk '!/^$/&&!/^#/{printf("ipset=/.%s/'"blacklist"'\n",$0)}' /etc/config/black.list > /tmp/dnsmasq.vssr/blacklist_forward.conf
|
||||
awk '!/^$/&&!/^#/{printf("server=/.%s/'"127.0.0.1#5335"'\n",$0)}' /etc/config/black.list >> /tmp/dnsmasq.vssr/blacklist_forward.conf
|
||||
|
||||
awk '!/^$/&&!/^#/{printf("ipset=/.%s/'"whitelist"'\n",$0)}' /etc/config/white.list > /tmp/dnsmasq.vssr/whitelist_forward.conf
|
||||
|
||||
awk '!/^$/&&!/^#/{printf("ipset=/.%s/'"whitelist"'\n",$0)}' /etc/config/white.list > /tmp/dnsmasq.ssr/whitelist_forward.conf
|
||||
|
||||
@ -21,10 +21,10 @@ log('正在更新【GFW列表】数据库')
|
||||
luci.sys.call("/usr/bin/vssr-gfw")
|
||||
icount = luci.sys.exec("cat /tmp/gfwnew.txt | wc -l")
|
||||
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.vssr/gfw_list.conf | wc -l")
|
||||
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 /tmp/dnsmasq.ssr/gfw_list.conf")
|
||||
luci.sys.exec("cp -f /tmp/gfwnew.txt /etc/dnsmasq.vssr/gfw_list.conf")
|
||||
luci.sys.exec("cp -f /tmp/gfwnew.txt /tmp/dnsmasq.vssr/gfw_list.conf")
|
||||
log('更新成功! 新的总纪录数:'.. icount)
|
||||
else
|
||||
log('你已经是最新数据,无需更新!')
|
||||
@ -73,14 +73,14 @@ if sret== 0 then
|
||||
luci.sys.call("/usr/bin/vssr-ad")
|
||||
icount = luci.sys.exec("cat /tmp/ad.conf | wc -l")
|
||||
if tonumber(icount)>1000 then
|
||||
if nixio.fs.access("/etc/dnsmasq.ssr/ad.conf") then
|
||||
oldcount=luci.sys.exec("cat /etc/dnsmasq.ssr/ad.conf | wc -l")
|
||||
if nixio.fs.access("/etc/dnsmasq.vssr/ad.conf") then
|
||||
oldcount=luci.sys.exec("cat /etc/dnsmasq.vssr/ad.conf | wc -l")
|
||||
else
|
||||
oldcount=0
|
||||
end
|
||||
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 /tmp/dnsmasq.ssr/ad.conf")
|
||||
luci.sys.exec("cp -f /tmp/ad.conf /etc/dnsmasq.vssr/ad.conf")
|
||||
luci.sys.exec("cp -f /tmp/ad.conf /tmp/dnsmasq.vssr/ad.conf")
|
||||
log('更新成功! 新的总纪录数:'.. icount)
|
||||
else
|
||||
log('你已经是最新数据,无需更新!')
|
||||
|
||||
Loading…
Reference in New Issue
Block a user