diff --git a/package/ctcgfw/luci-app-vssr/Makefile b/package/ctcgfw/luci-app-vssr/Makefile index 51050ea403..e2b4aa7955 100644 --- a/package/ctcgfw/luci-app-vssr/Makefile +++ b/package/ctcgfw/luci-app-vssr/Makefile @@ -1,8 +1,8 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-vssr -PKG_VERSION:=1.26 -PKG_RELEASE:=20200319-4 +PKG_VERSION:=1.27 +PKG_RELEASE:=20200323-4 PKG_CONFIG_DEPENDS:= CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks \ CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_V2ray \ @@ -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 +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 +python3-maxminddb +curl \ +PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks:shadowsocks-libev-ss-redir \ +PACKAGE_$(PKG_NAME)_INCLUDE_V2ray:v2ray \ +PACKAGE_$(PKG_NAME)_INCLUDE_Trojan:trojan \ diff --git a/package/ctcgfw/luci-app-vssr/luasrc/controller/vssr.lua b/package/ctcgfw/luci-app-vssr/luasrc/controller/vssr.lua index 55a754c79f..e8d7d366a1 100644 --- a/package/ctcgfw/luci-app-vssr/luasrc/controller/vssr.lua +++ b/package/ctcgfw/luci-app-vssr/luasrc/controller/vssr.lua @@ -1,4 +1,4 @@ --- Copyright (C) 2018 jerrykuku +-- Copyright (C) 2020 yushi studio -- Licensed to the public under the GNU General Public License v3. module("luci.controller.vssr", package.seeall) @@ -6,7 +6,6 @@ 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 @@ -15,7 +14,7 @@ end entry({"admin", "vpn", "vssr", "servers"}, arcombine(cbi("vssr/servers"), cbi("vssr/client-config")), _("Node List"), 20).leaf =true entry({"admin", "vpn", "vssr", "subscription"},cbi("vssr/subscription"),_("Subscription"),30).leaf=true entry({"admin", "vpn", "vssr", "control"}, cbi("vssr/control"), _("Access Control"), 40).leaf=true - entry({"admin", "vpn", "vssr", "servers-list"}, cbi("vssr/servers-list"), _("Severs Nodes"), 50).leaf =true + entry({"admin", "vpn", "vssr", "servers-list"}, arcombine(cbi("vssr/servers-list"), cbi("vssr/client-config")), _("Severs Nodes"), 50).leaf =true entry({"admin", "vpn", "vssr", "appointlist"},form("vssr/appointlist"),_("Appointlist List"),60).leaf =true entry({"admin", "vpn", "vssr", "udp2raw"},cbi("vssr/udp2raw"),_("udp2raw tunnel"),70).leaf = true entry({"admin", "vpn", "vssr", "advanced"}, cbi("vssr/advanced"),_("Advanced Settings"), 80).leaf =true @@ -41,9 +40,7 @@ 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" @@ -75,12 +72,9 @@ 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() @@ -97,7 +91,6 @@ function get_servers() luci.http.prepare_content("application/json") luci.http.write_json(server_table) end - -- 切换节点 function change_node() local e = {} @@ -116,7 +109,6 @@ 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() @@ -134,8 +126,6 @@ function switch() luci.http.prepare_content("application/json") luci.http.write_json(e) end - - -- 检测全局服务器状态 function act_status() math.randomseed(os.time()) @@ -144,205 +134,197 @@ function act_status() 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 - + 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 +-- 检测国内通道 + 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 +-- 检测国外通道 + 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 + 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) + 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("ping -c 1 -W 1 %q 2>&1 | grep -o 'time=[0-9]*.[0-9]' | awk -F '=' '{print$2}'" % domain) - 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(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) 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.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" 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" - 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" + 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 .. " 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) + 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" 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 = "

" - 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 = "

" + 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) @@ -467,14 +449,14 @@ function get_flag() 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 diff --git a/package/ctcgfw/luci-app-vssr/luasrc/model/cbi/vssr/client.lua b/package/ctcgfw/luci-app-vssr/luasrc/model/cbi/vssr/client.lua index 87c4b6139f..65bc22ec4d 100644 --- a/package/ctcgfw/luci-app-vssr/luasrc/model/cbi/vssr/client.lua +++ b/package/ctcgfw/luci-app-vssr/luasrc/model/cbi/vssr/client.lua @@ -83,7 +83,39 @@ o:value("", translate("Disable")) o:value("same", translate("Same as Global Server")) for _,key in pairs(key_table) do o:value(key,server_table[key]) end +o = s:option(Flag, "v2ray_flow", translate("Open v2ray split-flow") .."") +o.rmempty = false +o.description = ("" ..translate("When open v2ray split-flow,your main server must be a v2ray server").."") +o = s:option(ListValue, "youtube_server", translate("Youtube Proxy")) +o:value("nil", translate("Same as Global Server")) +for _,key in pairs(key_table_v2) do o:value(key,v2ray_table[key]) end +o:depends("v2ray_flow", "1") +o.default = "nil" + +o = s:option(ListValue, "tw_video_server", translate("TaiWan Video Proxy")) +o:value("nil", translate("Same as Global Server")) +for _,key in pairs(key_table_v2) do o:value(key,v2ray_table[key]) end +o:depends("v2ray_flow", "1") +o.default = "nil" + +o = s:option(ListValue, "netflix_server", translate("Netflix Proxy")) +o:value("nil", translate("Same as Global Server")) +for _,key in pairs(key_table_v2) do o:value(key,v2ray_table[key]) end +o:depends("v2ray_flow", "1") +o.default = "nil" + +o = s:option(ListValue, "disney_server", translate("Diseny+ Proxy")) +o:value("nil", translate("Same as Global Server")) +for _,key in pairs(key_table_v2) do o:value(key,v2ray_table[key]) end +o:depends("v2ray_flow", "1") +o.default = "nil" + +o = s:option(ListValue, "prime_server", translate("Prime Video Proxy")) +o:value("nil", translate("Same as Global Server")) +for _,key in pairs(key_table_v2) do o:value(key,v2ray_table[key]) end +o:depends("v2ray_flow", "1") +o.default = "nil" o = s:option(ListValue, "threads", translate("Multi Threads Option")) o:value("0", translate("Auto Threads")) @@ -138,6 +170,13 @@ if nixio.fs.access("/usr/bin/dnscrypt-proxy") then o:value("5", translate("Use dnscrypt-proxy query and cache")) end +if nixio.fs.access("/usr/sbin/smartdns") then +o:value("6", translate("Use smartdns query and cache")) +end + +if nixio.fs.access("/usr/sbin/https_dns_proxy") then +o:value("7", translate("Use https_dns_proxy query and cache")) +end o.default = 1 o:depends("pdnsd_enable", "6") @@ -167,72 +206,6 @@ o:depends("pdnsd_enable", "7") o.default = "8.8.4.4:53" --- [[ SOCKS5 Proxy ]]-- -if nixio.fs.access("/usr/bin/ssr-local") then - -s = m:section(TypedSection, "socks5_proxy", translate("SOCKS5 Proxy")) -s.anonymous = true -o = s:option(ListValue, "server", translate("Server")) -o:value("nil", translate("Disable")) -for _,key in pairs(key_table) do o:value(key,server_table[key]) end -o.default = "nil" -o.rmempty = false - -o = s:option(Value, "local_port", translate("Local Port")) -o.datatype = "port" -o.default = 1080 -o.rmempty = false - --- [[ HTTP Proxy ]]-- -if nixio.fs.access("/usr/sbin/privoxy") then -o = s:option(Flag, "http_enable", translate("Enable HTTP Proxy")) -o.rmempty = false - -o = s:option(Value, "http_port", translate("HTTP Port")) -o.datatype = "port" -o.default = 1081 -o.rmempty = false -end -end -o = s:option(Flag, "v2ray_flow", translate("Open v2ray split-flow") .."") -o.rmempty = false -o.description = ("" ..translate("When open v2ray split-flow,your main server must be a v2ray server").."") - -o = s:option(ListValue, "youtube_server", translate("Youtube Proxy")) -o:value("nil", translate("Same as Global Server")) -for _,key in pairs(key_table_v2) do o:value(key,v2ray_table[key]) end -o:depends("v2ray_flow", "1") -o.default = "nil" - - - -o = s:option(ListValue, "tw_video_server", translate("TaiWan Video Proxy")) -o:value("nil", translate("Same as Global Server")) -for _,key in pairs(key_table_v2) do o:value(key,v2ray_table[key]) end -o:depends("v2ray_flow", "1") -o.default = "nil" - - -o = s:option(ListValue, "netflix_server", translate("Netflix Proxy")) -o:value("nil", translate("Same as Global Server")) -for _,key in pairs(key_table_v2) do o:value(key,v2ray_table[key]) end -o:depends("v2ray_flow", "1") -o.default = "nil" - - -o = s:option(ListValue, "disney_server", translate("Diseny+ Proxy")) -o:value("nil", translate("Same as Global Server")) -for _,key in pairs(key_table_v2) do o:value(key,v2ray_table[key]) end -o:depends("v2ray_flow", "1") -o.default = "nil" - - -o = s:option(ListValue, "prime_server", translate("Prime Video Proxy")) -o:value("nil", translate("Same as Global Server")) -for _,key in pairs(key_table_v2) do o:value(key,v2ray_table[key]) end -o:depends("v2ray_flow", "1") -o.default = "nil" - o = s:option(Button,"gfw_data",translate("GFW List Data")) o.rawhtml = true o.template = "vssr/refresh" diff --git a/package/ctcgfw/luci-app-vssr/luasrc/model/cbi/vssr/servers-list.lua b/package/ctcgfw/luci-app-vssr/luasrc/model/cbi/vssr/servers-list.lua index 039295445d..f4207d44cf 100644 --- a/package/ctcgfw/luci-app-vssr/luasrc/model/cbi/vssr/servers-list.lua +++ b/package/ctcgfw/luci-app-vssr/luasrc/model/cbi/vssr/servers-list.lua @@ -15,8 +15,8 @@ end) -m = Map(vssr) -m:section(SimpleSection).template = "vssr/status" +m = Map(vssr, translate("Node List")) +m:section(SimpleSection).template = "vssr/status1" -- [[ Servers Manage ]]-- @@ -34,35 +34,43 @@ function s.create(...) return end end - -o = s:option(DummyValue, "type", translate("Type")) -o.width="1%" - o = s:option(DummyValue, "alias", translate("Alias")) -o.width="1%" +o.width="10%" +o = s:option(DummyValue, "type", translate("Type")) +o.width="15%" o = s:option(DummyValue, "server", translate("Server Address")) -o.width="30%" +o.width="10%" o = s:option(DummyValue, "server_port", translate("Server Port")) -o.width="30%" +o.width="10%" +o = s:option(DummyValue, "encrypt_method", translate("Encrypt Method")) +o.width="10%" -o = s:option(DummyValue,"security",translate("Encrypt Method")) -o.width="1%" +o = s:option(DummyValue, "protocol", translate("Protocol")) +o.width="10%" +o = s:option(DummyValue, "obfs", translate("Obfs")) +o.width="10%" o = s:option(Flag, "switch_enable", translate("Enable Auto Switch")) -o.width="1%" +o.width="10%" + +if nixio.fs.access("/usr/bin/kcptun-client") then + +o = s:option(Flag, "kcp_enable", translate("KcpTun")) +o.width="10%" +end o = s:option(DummyValue, "server_port", translate("Socket Connected")) o.template="vssr/socket" -o.width="1%" +o.width="10%" o = s:option(DummyValue,"server",translate("Ping Latency")) o.template="vssr/ping" -o.width="1%" +o.width="10%" m:append(Template("vssr/server_list")) -m:section(SimpleSection).template = "vssr/status2" + return m diff --git a/package/ctcgfw/luci-app-vssr/luasrc/model/cbi/vssr/status.lua b/package/ctcgfw/luci-app-vssr/luasrc/model/cbi/vssr/status.lua index 1d3b5f7a35..2bfc090c93 100644 --- a/package/ctcgfw/luci-app-vssr/luasrc/model/cbi/vssr/status.lua +++ b/package/ctcgfw/luci-app-vssr/luasrc/model/cbi/vssr/status.lua @@ -1,7 +1,7 @@ -- Copyright (C) 2017 yushi studio -- Licensed to the public under the GNU General Public License v3. -local IPK_Version="20200319.1.26" +local IPK_Version="20200323.1.27" local m, s, o local redir_run=0 local reudp_run=0 diff --git a/package/ctcgfw/luci-app-vssr/luasrc/view/vssr/server_list.htm b/package/ctcgfw/luci-app-vssr/luasrc/view/vssr/server_list.htm index ac62dbc38f..b7bde2aaf4 100644 --- a/package/ctcgfw/luci-app-vssr/luasrc/view/vssr/server_list.htm +++ b/package/ctcgfw/luci-app-vssr/luasrc/view/vssr/server_list.htm @@ -48,4 +48,6 @@ local dsp = require "luci.dispatcher" for (let i = 0; i < 10; i++) { thread() } - \ No newline at end of file + + + diff --git a/package/ctcgfw/luci-app-vssr/luasrc/view/vssr/status.htm b/package/ctcgfw/luci-app-vssr/luasrc/view/vssr/status.htm index b46b4d48aa..7388804954 100644 --- a/package/ctcgfw/luci-app-vssr/luasrc/view/vssr/status.htm +++ b/package/ctcgfw/luci-app-vssr/luasrc/view/vssr/status.htm @@ -28,7 +28,7 @@ math.randomseed(os.time())
-

<%:domestic website%>
<%:Problem detected%>✘

+

<%:baidu%>
<%:Problem detected%>✘

@@ -41,7 +41,7 @@ math.randomseed(os.time())
-

<%:foreign websites%>
<%:Problem detected%>✘

+

<%:youtube%>
<%:Problem detected%>✘

@@ -115,14 +115,14 @@ math.randomseed(os.time()) tb.innerHTML = '<%:Client%>
<%:Not Running%>✘'; } if (data.google) { - tb1.innerHTML = '<%:foreign websites%>
<%:Connect OK%>✔'; + tb1.innerHTML = '<%:youtube%>
<%:Connect OK%>✔'; } else { - tb1.innerHTML = '<%:foreign websites%>
<%:Problem detected%>✘'; + tb1.innerHTML = '<%:youtube%>
<%:Problem detected%>✘'; } if (data.baidu) { - tb2.innerHTML = '<%:domestic website%>
<%:Connect OK%>✔'; + tb2.innerHTML = '<%:baidu%>
<%:Connect OK%>✔'; } else { - tb2.innerHTML = '<%:domestic website%>
<%:Problem detected%>✘'; + tb2.innerHTML = '<%:baidu%>
<%:Problem detected%>✘'; } if (data.game) { tb3.innerHTML = '<%:Game Mode%>
<%:Running%>✔'; diff --git a/package/ctcgfw/luci-app-vssr/luasrc/view/vssr/status1.htm b/package/ctcgfw/luci-app-vssr/luasrc/view/vssr/status1.htm new file mode 100644 index 0000000000..1714211ab5 --- /dev/null +++ b/package/ctcgfw/luci-app-vssr/luasrc/view/vssr/status1.htm @@ -0,0 +1,247 @@ + + +
+ + <%:Running Status%> + + + + + + + + + +
+
+
+
+

<%:Client%>
<%:Not Running%>✘

+
+
+
+ +
+
+
+
+
+
+
+

<%:baidu%>
<%:Problem detected%>✘

+
+
+
+ +
+
+
+
+ +
+
+
+

<%:youtube%>
<%:Problem detected%>✘

+
+
+
+ +
+
+
+
+ +
+
+
+

<%:Game Mode%>
<%:Not Running%>✘

+
+
+
+ +
+
+
+
+
+
+
+

𝐂𝐡𝐢𝐧𝐚𝐃𝐍𝐒
<%:Not Running%>✘

+
+
+
+ +
+
+
+
+
+
+
+

𝙎𝙊𝘾𝙆𝙎5
<%:Not Running%>✘

+
+
+
+ +
+
+
+
+
+ + + + +
diff --git a/package/ctcgfw/luci-app-vssr/luasrc/view/vssr/status3.htm b/package/ctcgfw/luci-app-vssr/luasrc/view/vssr/status3.htm index 3f1f85e0d1..2c0cff25e3 100644 --- a/package/ctcgfw/luci-app-vssr/luasrc/view/vssr/status3.htm +++ b/package/ctcgfw/luci-app-vssr/luasrc/view/vssr/status3.htm @@ -97,7 +97,7 @@
-

<%:domestic website%>
<%:Problem detected%>✘

+

<%:baidu%>
<%:Problem detected%>✘

@@ -109,7 +109,7 @@
-

<%:foreign websites%>
<%:Problem detected%>✘

+

<%:youtube%>
<%:Problem detected%>✘

@@ -166,8 +166,8 @@ function (x, data) { if (data) { document.getElementById('vssr_status').innerHTML = data.global?'<%:Client%>
<%:Running%>✔':'<%:Client%>
<%:Not Running%>✘'; - document.getElementById('baidu_status').innerHTML = data.baidu?'<%:domestic website%>
<%:Connect OK%>✔':'<%:domestic website%>
<%:Problem detected%>✘'; - document.getElementById('google_status').innerHTML = data.google?'<%:foreign websites%>
<%:Connect OK%>✔':'<%:foreign websites%>
<%:Problem detected%>✘'; + document.getElementById('baidu_status').innerHTML = data.baidu?'<%:baidu%>
<%:Connect OK%>✔':'<%:baidu%>
<%:Problem detected%>✘'; + document.getElementById('google_status').innerHTML = data.google?'<%:youtube%>
<%:Connect OK%>✔':'<%:youtube%>
<%:Problem detected%>✘'; document.getElementById('ss_server_status').innerHTML = data.ss_server?'<%:SS Servers%>
<%:Running%>✔':'<%:SS Servers%>
<%:Not Running%>✘'; document.getElementById('ssr_server_status').innerHTML = data.ssr_server?'<%:SSR Servers%>
<%:Running%>✔':'<%:SSR Servers%>
<%:Not Running%>✘'; document.getElementById('v2_server_status').innerHTML = data.v2_server?'<%:V2 Servers%>
<%:Running%>✔':'<%:V2 Servers%>
<%:Not Running%>✘'; diff --git a/package/ctcgfw/luci-app-vssr/po/zh-cn/vssr.po b/package/ctcgfw/luci-app-vssr/po/zh-cn/vssr.po index 6cd2bda08b..d2b90e4240 100644 --- a/package/ctcgfw/luci-app-vssr/po/zh-cn/vssr.po +++ b/package/ctcgfw/luci-app-vssr/po/zh-cn/vssr.po @@ -125,10 +125,10 @@ msgstr "个节点" msgid "Client" msgstr "客户端" -msgid "foreign websites" +msgid "youtube" msgstr "国外网站" -msgid "domestic website" +msgid "baidu" msgstr "国内网站" msgid "Problem detected" diff --git a/package/ctcgfw/luci-app-vssr/root/etc/init.d/vssr b/package/ctcgfw/luci-app-vssr/root/etc/init.d/vssr index 154e0996cb..1d93c485eb 100755 --- a/package/ctcgfw/luci-app-vssr/root/etc/init.d/vssr +++ b/package/ctcgfw/luci-app-vssr/root/etc/init.d/vssr @@ -1062,13 +1062,16 @@ 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 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 diff --git a/package/ctcgfw/luci-app-vssr/root/etc/uci-defaults/luci-vssr b/package/ctcgfw/luci-app-vssr/root/etc/uci-defaults/luci-vssr index dcb6b38e69..1abad58b87 100755 --- a/package/ctcgfw/luci-app-vssr/root/etc/uci-defaults/luci-vssr +++ b/package/ctcgfw/luci-app-vssr/root/etc/uci-defaults/luci-vssr @@ -17,7 +17,7 @@ EOF /etc/init.d/dnscrypt-proxy disable /etc/init.d/privoxy stop /etc/init.d/privoxy disable -killall -q -9 v2ray-plugin +killall -q -9 v2ray-plugin dnscrypt-proxy dns2socks dnsforwarder chinadns /usr/share/vssr/gfw2ipset.sh rm -f /tmp/luci-indexcache diff --git a/package/ctcgfw/luci-app-vssr/root/usr/share/vssr/getflag.sh b/package/ctcgfw/luci-app-vssr/root/usr/share/vssr/getflag.sh index dc33e95953..339322ee02 100755 --- a/package/ctcgfw/luci-app-vssr/root/usr/share/vssr/getflag.sh +++ b/package/ctcgfw/luci-app-vssr/root/usr/share/vssr/getflag.sh @@ -1,12 +1,13 @@ #!/bin/bash # Copyright (C) 2019 Jerryk -python=python3 +lua=/usr/bin/lua name="$1" host=$2 code='' -iso_array=(AC AD AE AF AG AI AL AM AO AQ AR AS AT AU AW AX AZ BA BB BD BE BF BG BH BI BJ BL BM BN BO BQ BR BS BT BV BW BY BZ CA CC CD CF CG CH CI CK CL CM CN CO CP CR CU CV CW CX CY CZ DE DG DJ DK DM DO DZ EA EC EE EG EH ER ES ET EU FI FJ FK FM FO FR GA GB GD GE GF GG GH GI GL GM GN GP GQ GR GS GT GU GW GY HK HM HN HR HT HU IC ID IE IL IM IN IO IQ IR IS IT JE JM JO JP KE KG KH KI KM KN KP KR KW KY KZ LA LB LC LI LK LR LS LT LU LV LY MA MC MD ME MF MG MH MK ML MM MN MO MP MQ MR MS MT MU MV MW MX MY MZ NA NC NE NF NG NI NL NO NP NR NU NZ OM PA PE PF PG PH PK PL PM PN PR PS PT PW PY QA RE RO RS RU RW SA SB SC SD SE SG SH SI SJ SK SL SM SN SO SR SS ST SV SX SY SZ TA TC TD TF TG TH TJ TK TL TM TN TO TR TT TV TW TZ UA UG UM UN US UY UZ VA VC VE VG VI VN VU WF WS XK YE YT ZA ZM ZW) +iso_array=(AC AD AE AF AG AI AL AM AO AQ AR AS AT AU AW AX AZ BA BB BD BE BF BG BH BI BJ BL BM BN BO BQ BR BS BT BV BW BY BZ CA CC CD CF CG CH CI CK CL CM CN CO CP CR CU CV CW CX CY CZ DE DG DJ DK DM DO DZ EA EC EE EG EH ER ES ET EU FI FJ FK FM FO FR GA GB GD GE GF GG GH GI GL GM GN GP GQ GR GS GT GU GW GY HK HM HN HR HT HU IC ID IE IL IM IN IO IQ IR IS IT JE JM JO JP KE KG KH KI KM KN KP KR KW KY KZ LA LB LC LI LK LR LS LT LU LV LY MA MC MD ME MF MG MH MK ML MM MN MO MP MQ MR MS MT MU MV MW MX MY MZ NA NC NE NF NG NI NL NO NP NR NU NZ OM PA PE PF PG PH PK PL PM PN PR PS PT PW PY QA RE RO RS RU RW SA SB SC SD SE SG SH SI SJ SK SL SM SN SO SR SS ST SV SX SY SZ TA TC TD TF TG TH TJ TK TL TM TN TO TR TT TV TW TZ UA UG UM UN US UY UZ VA VC VE VG VI VN VU WF WS XK YE YT ZA ZM ZW US HK TW JP GB GB DE FR IN TR SG KR RU IE CA ) + +emoji_array=(🇦🇨 🇦🇩 🇦🇪 🇦🇫 🇦🇬 🇦🇮 🇦🇱 🇦🇲 🇦🇴 🇦🇶 🇦🇷 🇦🇸 🇦🇹 🇦🇺 🇦🇼 🇦🇽 🇦🇿 🇧🇦 🇧🇧 🇧🇩 🇧🇪 🇧🇫 🇧🇬 🇧🇭 🇧🇮 🇧🇯 🇧🇱 🇧🇲 🇧🇳 🇧🇴 🇧🇶 🇧🇷 🇧🇸 🇧🇹 🇧🇻 🇧🇼 🇧🇾 🇧🇿 🇨🇦 🇨🇨 🇨🇩 🇨🇫 🇨🇬 🇨🇭 🇨🇮 🇨🇰 🇨🇱 🇨🇲 🇨🇳 🇨🇴 🇨🇵 🇨🇷 🇨🇺 🇨🇻 🇨🇼 🇨🇽 🇨🇾 🇨🇿 🇩🇪 🇩🇬 🇩🇯 🇩🇰 🇩🇲 🇩🇴 🇩🇿 🇪🇦 🇪🇨 🇪🇪 🇪🇬 🇪🇭 🇪🇷 🇪🇸 🇪🇹 🇪🇺 🇫🇮 🇫🇯 🇫🇰 🇫🇲 🇫🇴 🇫🇷 🇬🇦 🇬🇧 🇬🇩 🇬🇪 🇬🇫 🇬🇬 🇬🇭 🇬🇮 🇬🇱 🇬🇲 🇬🇳 🇬🇵 🇬🇶 🇬🇷 🇬🇸 🇬🇹 🇬🇺 🇬🇼 🇬🇾 🇭🇰 🇭🇲 🇭🇳 🇭🇷 🇭🇹 🇭🇺 🇮🇨 🇮🇩 🇮🇪 🇮🇱 🇮🇲 🇮🇳 🇮🇴 🇮🇶 🇮🇷 🇮🇸 🇮🇹 🇯🇪 🇯🇲 🇯🇴 🇯🇵 🇰🇪 🇰🇬 🇰🇭 🇰🇮 🇰🇲 🇰🇳 🇰🇵 🇰🇷 🇰🇼 🇰🇾 🇰🇿 🇱🇦 🇱🇧 🇱🇨 🇱🇮 🇱🇰 🇱🇷 🇱🇸 🇱🇹 🇱🇺 🇱🇻 🇱🇾 🇲🇦 🇲🇨 🇲🇩 🇲🇪 🇲🇫 🇲🇬 🇲🇭 🇲🇰 🇲🇱 🇲🇲 🇲🇳 🇲🇴 🇲🇵 🇲🇶 🇲🇷 🇲🇸 🇲🇹 🇲🇺 🇲🇻 🇲🇼 🇲🇽 🇲🇾 🇲🇿 🇳🇦 🇳🇨 🇳🇪 🇳🇫 🇳🇬 🇳🇮 🇳🇱 🇳🇴 🇳🇵 🇳🇷 🇳🇺 🇳🇿 🇴🇲 🇵🇦 🇵🇪 🇵🇫 🇵🇬 🇵🇭 🇵🇰 🇵🇱 🇵🇲 🇵🇳 🇵🇷 🇵🇸 🇵🇹 🇵🇼 🇵🇾 🇶🇦 🇷🇪 🇷🇴 🇷🇸 🇷🇺 🇷🇼 🇸🇦 🇸🇧 🇸🇨 🇸🇩 🇸🇪 🇸🇬 🇸🇭 🇸🇮 🇸🇯 🇸🇰 🇸🇱 🇸🇲 🇸🇳 🇸🇴 🇸🇷 🇸🇸 🇸🇹 🇸🇻 🇸🇽 🇸🇾 🇸🇿 🇹🇦 🇹🇨 🇹🇩 🇹🇫 🇹🇬 🇹🇭 🇹🇯 🇹🇰 🇹🇱 🇹🇲 🇹🇳 🇹🇴 🇹🇷 🇹🇹 🇹🇻 🇹🇼 🇹🇿 🇺🇦 🇺🇬 🇺🇲 🇺🇳 🇺🇸 🇺🇾 🇺🇿 🇻🇦 🇻🇨 🇻🇪 🇻🇬 🇻🇮 🇻🇳 🇻🇺 🇼🇫 🇼🇸 🇽🇰 🇾🇪 🇾🇹 🇿🇦 🇿🇲 🇿🇼 美国 香港 台湾 日本 英国 UK 德国 法国 印度 土耳其 新加坡 韩国 俄罗斯 爱尔兰 加拿大 ) -emoji_array=(🇦🇨 🇦🇩 🇦🇪 🇦🇫 🇦🇬 🇦🇮 🇦🇱 🇦🇲 🇦🇴 🇦🇶 🇦🇷 🇦🇸 🇦🇹 🇦🇺 🇦🇼 🇦🇽 🇦🇿 🇧🇦 🇧🇧 🇧🇩 🇧🇪 🇧🇫 🇧🇬 🇧🇭 🇧🇮 🇧🇯 🇧🇱 🇧🇲 🇧🇳 🇧🇴 🇧🇶 🇧🇷 🇧🇸 🇧🇹 🇧🇻 🇧🇼 🇧🇾 🇧🇿 🇨🇦 🇨🇨 🇨🇩 🇨🇫 🇨🇬 🇨🇭 🇨🇮 🇨🇰 🇨🇱 🇨🇲 🇨🇳 🇨🇴 🇨🇵 🇨🇷 🇨🇺 🇨🇻 🇨🇼 🇨🇽 🇨🇾 🇨🇿 🇩🇪 🇩🇬 🇩🇯 🇩🇰 🇩🇲 🇩🇴 🇩🇿 🇪🇦 🇪🇨 🇪🇪 🇪🇬 🇪🇭 🇪🇷 🇪🇸 🇪🇹 🇪🇺 🇫🇮 🇫🇯 🇫🇰 🇫🇲 🇫🇴 🇫🇷 🇬🇦 🇬🇧 🇬🇩 🇬🇪 🇬🇫 🇬🇬 🇬🇭 🇬🇮 🇬🇱 🇬🇲 🇬🇳 🇬🇵 🇬🇶 🇬🇷 🇬🇸 🇬🇹 🇬🇺 🇬🇼 🇬🇾 🇭🇰 🇭🇲 🇭🇳 🇭🇷 🇭🇹 🇭🇺 🇮🇨 🇮🇩 🇮🇪 🇮🇱 🇮🇲 🇮🇳 🇮🇴 🇮🇶 🇮🇷 🇮🇸 🇮🇹 🇯🇪 🇯🇲 🇯🇴 🇯🇵 🇰🇪 🇰🇬 🇰🇭 🇰🇮 🇰🇲 🇰🇳 🇰🇵 🇰🇷 🇰🇼 🇰🇾 🇰🇿 🇱🇦 🇱🇧 🇱🇨 🇱🇮 🇱🇰 🇱🇷 🇱🇸 🇱🇹 🇱🇺 🇱🇻 🇱🇾 🇲🇦 🇲🇨 🇲🇩 🇲🇪 🇲🇫 🇲🇬 🇲🇭 🇲🇰 🇲🇱 🇲🇲 🇲🇳 🇲🇴 🇲🇵 🇲🇶 🇲🇷 🇲🇸 🇲🇹 🇲🇺 🇲🇻 🇲🇼 🇲🇽 🇲🇾 🇲🇿 🇳🇦 🇳🇨 🇳🇪 🇳🇫 🇳🇬 🇳🇮 🇳🇱 🇳🇴 🇳🇵 🇳🇷 🇳🇺 🇳🇿 🇴🇲 🇵🇦 🇵🇪 🇵🇫 🇵🇬 🇵🇭 🇵🇰 🇵🇱 🇵🇲 🇵🇳 🇵🇷 🇵🇸 🇵🇹 🇵🇼 🇵🇾 🇶🇦 🇷🇪 🇷🇴 🇷🇸 🇷🇺 🇷🇼 🇸🇦 🇸🇧 🇸🇨 🇸🇩 🇸🇪 🇸🇬 🇸🇭 🇸🇮 🇸🇯 🇸🇰 🇸🇱 🇸🇲 🇸🇳 🇸🇴 🇸🇷 🇸🇸 🇸🇹 🇸🇻 🇸🇽 🇸🇾 🇸🇿 🇹🇦 🇹🇨 🇹🇩 🇹🇫 🇹🇬 🇹🇭 🇹🇯 🇹🇰 🇹🇱 🇹🇲 🇹🇳 🇹🇴 🇹🇷 🇹🇹 🇹🇻 🇹🇼 🇹🇿 🇺🇦 🇺🇬 🇺🇲 🇺🇳 🇺🇸 🇺🇾 🇺🇿 🇻🇦 🇻🇨 🇻🇪 🇻🇬 🇻🇮 🇻🇳 🇻🇺 🇼🇫 🇼🇸 🇽🇰 🇾🇪 🇾🇹 🇿🇦 🇿🇲 🇿🇼) for i in "${!emoji_array[@]}"; do if [[ $name == *${emoji_array[$i]}* ]]; then @@ -18,6 +19,8 @@ done if [ ! -z $code ]; then echo $code | tr "[A-Z]" "[a-z]" else + + 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 @@ -30,5 +33,6 @@ else hostip=$(cat /etc/ssr_ip) fi fi - $python -c "import maxminddb;import json;reader = maxminddb.open_database('/usr/share/vssr/GeoLite2-Country.mmdb');aa = reader.get('${hostip}');reader.close();print(aa['country']['iso_code'].lower())" + lua /usr/share/vssr/iso_code.lua $hostip fi + diff --git a/package/ctcgfw/luci-app-vssr/root/usr/share/vssr/iso_code.lua b/package/ctcgfw/luci-app-vssr/root/usr/share/vssr/iso_code.lua new file mode 100644 index 0000000000..c7d6c37953 --- /dev/null +++ b/package/ctcgfw/luci-app-vssr/root/usr/share/vssr/iso_code.lua @@ -0,0 +1,10 @@ +#!/usr/bin/lua +------------------------------------------------ +-- This file is converter ip to country iso code +-- @author Jerryk +------------------------------------------------ + +local mm = require 'maxminddb' +local db = mm.open('/usr/share/vssr/GeoLite2-Country.mmdb') +local res = db:lookup(arg[1]) +print(string.lower(res:get("country", "iso_code"))) \ No newline at end of file