luci-app-vssr: bump to v1.16

This commit is contained in:
CN_SZTL 2020-08-26 15:31:34 +08:00
parent 42b5144652
commit 5dfc9cc357
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
32 changed files with 1544 additions and 1702 deletions

View File

@ -1,8 +1,8 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-vssr
PKG_VERSION:=1.15
PKG_RELEASE:=20200825
PKG_VERSION:=1.16
PKG_RELEASE:=20200826
include $(INCLUDE_DIR)/package.mk

View File

@ -97,19 +97,26 @@ end
-- 切换节点
function change_node()
local sockets = require "socket"
local e = {}
local uci = luci.model.uci.cursor()
local sid = luci.http.formvalue("set")
local server = luci.http.formvalue("server")
local flow_table = {"youtube","tw_video","netflix","disney","prime","tvb","custom"}
e.status = false
e.sid = sid
if sid ~= "" and server ~= "" then
uci:set("vssr", '@global[0]', server..'_server', sid)
if( server ~= "global" ) then
if( server ~= "global" and server ~= "udp_relay" ) then
uci:set("vssr", '@global[0]', 'v2ray_flow', "1")
for i, v in pairs(flow_table) do
if( v ~= server) then
uci:set("vssr", '@global[0]', v..'_server', 'nil')
end
end
end
uci:commit("vssr")
luci.sys.exec("/etc/init.d/vssr restart")
luci.sys.call("/etc/init.d/vssr restart >/www/restartlog.htm 2>&1")
e.status = true
end
luci.http.prepare_content("application/json")
@ -178,12 +185,18 @@ function check_ip()
local d = {}
local mm = require 'maxminddb'
local vssr = require "vssrutil"
local port = 80
local db = mm.open('/usr/share/vssr/GeoLite2-Country.mmdb')
local ip = vssr.wget("http://api.ipify.org/")
if (ip ~= "") then
local res = db:lookup(ip)
local port = 80
d.flag = string.lower(res:get("country", "iso_code"))
d.country = res:get("country", "names", "zh-CN")
else
d.flag = "un"
d.country = "Unknown"
ip = "Unknown"
end
e.outboard = ip
e.outboardip = d
e.baidu = vssr.check_site("www.baidu.com",port)

View File

@ -6,6 +6,7 @@ local gfwmode = 0
local gfw_count = 0
local ip_count = 0
local ad_count = 0
local server_count = 0
if nixio.fs.access("/etc/dnsmasq.ssr/gfw_list.conf") then gfwmode = 1 end
@ -23,24 +24,11 @@ if nixio.fs.access("/etc/china_ssr.txt") then
ip_count = sys.exec("cat /etc/china_ssr.txt | wc -l")
end
uci:foreach(vssr, "servers", function(s)
if s["type"] == "v2ray" then
if s.alias then
server_table[s[".name"]] = "[%s]:%s" %
{string.upper(s.type), s.alias}
elseif s.server and s.server_port then
server_table[s[".name"]] = "[%s]:%s:%s" %
{
string.upper(s.type), s.server, s.server_port
}
end
end
uci:foreach("vssr", "servers", function(s)
server_count = server_count + 1
end)
local key_table = {}
for key, _ in pairs(server_table) do table.insert(key_table, key) end
table.sort(key_table)
m = Map(vssr)
-- [[ 服务器节点故障自动切换设置 ]]--
@ -98,14 +86,22 @@ o = s:option(DummyValue, "", "")
o.rawhtml = true
o.template = "vssr/update_subscribe"
o = s:option(Button, "delete", translate("Delete all severs"))
o = s:option(Button,"delete",translate("Delete All Subscribe Severs"))
o.inputstyle = "reset"
o.description = string.format(translate("Server Count") .. ": %d", server_count)
o.write = function()
uci:delete_all("vssr", "servers", function(s) return true end)
uci:delete_all("vssr", "servers", function(s)
if s.hashkey or s.isSubscribe then
return true
else
return false
end
end)
uci:save("vssr")
uci:commit("vssr")
luci.sys.exec("/etc/init.d/vssr stop")
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "vssr",
"advanced"))
luci.sys.exec("/etc/init.d/vssr restart")
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "vssr", "servers"))
return
end
-- [[ adblock ]]--

View File

@ -18,85 +18,33 @@ end
local server_table = {}
local encrypt_methods = {
"none",
"table",
"rc4",
"rc4-md5-6",
"rc4-md5",
"aes-128-cfb",
"aes-192-cfb",
"aes-256-cfb",
"aes-128-ctr",
"aes-192-ctr",
"aes-256-ctr",
"bf-cfb",
"camellia-128-cfb",
"camellia-192-cfb",
"camellia-256-cfb",
"cast5-cfb",
"des-cfb",
"idea-cfb",
"rc2-cfb",
"seed-cfb",
"salsa20",
"chacha20",
"chacha20-ietf",
"none", "table", "rc4", "rc4-md5-6", "rc4-md5", "aes-128-cfb",
"aes-192-cfb", "aes-256-cfb", "aes-128-ctr", "aes-192-ctr", "aes-256-ctr",
"bf-cfb", "camellia-128-cfb", "camellia-192-cfb", "camellia-256-cfb",
"cast5-cfb", "des-cfb", "idea-cfb", "rc2-cfb", "seed-cfb", "salsa20",
"chacha20", "chacha20-ietf"
}
local encrypt_methods_ss = {
-- aead
"aes-128-gcm",
"aes-192-gcm",
"aes-256-gcm",
"chacha20-ietf-poly1305",
"xchacha20-ietf-poly1305",
-- stream
"table",
"rc4",
"rc4-md5",
"aes-128-cfb",
"aes-192-cfb",
"aes-256-cfb",
"aes-128-ctr",
"aes-192-ctr",
"aes-256-ctr",
"bf-cfb",
"camellia-128-cfb",
"camellia-192-cfb",
"camellia-256-cfb",
"salsa20",
"chacha20",
"chacha20-ietf",
-- aead
"aes-128-gcm", "aes-192-gcm", "aes-256-gcm", "chacha20-ietf-poly1305",
"xchacha20-ietf-poly1305", -- stream
"table", "rc4", "rc4-md5", "aes-128-cfb", "aes-192-cfb", "aes-256-cfb",
"aes-128-ctr", "aes-192-ctr", "aes-256-ctr", "bf-cfb", "camellia-128-cfb",
"camellia-192-cfb", "camellia-256-cfb", "salsa20", "chacha20",
"chacha20-ietf"
}
local protocol = {
"origin",
"verify_deflate",
"auth_sha1_v4",
"auth_aes128_sha1",
"auth_aes128_md5",
"auth_chain_a",
"auth_chain_b",
"auth_chain_c",
"auth_chain_d",
"auth_chain_e",
"auth_chain_f",
"origin", "verify_deflate", "auth_sha1_v4", "auth_aes128_sha1",
"auth_aes128_md5", "auth_chain_a", "auth_chain_b", "auth_chain_c",
"auth_chain_d", "auth_chain_e", "auth_chain_f"
}
obfs = {
"plain",
"http_simple",
"http_post",
"random_head",
"tls1.2_ticket_auth",
"plain", "http_simple", "http_post", "random_head", "tls1.2_ticket_auth"
}
local securitys = {
"auto",
"none",
"aes-128-gcm",
"chacha20-poly1305"
}
local securitys = {"auto", "none", "aes-128-gcm", "chacha20-poly1305"}
m = Map(vssr, translate("Edit vssr Server"))
m.redirect = luci.dispatcher.build_url("admin/services/vssr/servers")
@ -180,7 +128,6 @@ o = s:option(Value, "plugin_opts", translate("Plugin Opts"))
o.rmempty = true
o:depends("type", "ss")
o = s:option(ListValue, "protocol", translate("Protocol"))
for _, v in ipairs(protocol) do o:value(v) end
o.rmempty = true
@ -194,8 +141,6 @@ for _, v in ipairs(obfs) do o:value(v) end
o.rmempty = true
o:depends("type", "ssr")
o = s:option(Value, "obfs_param", translate("Obfs param(optional)"))
o:depends("type", "ssr")

View File

@ -1,14 +1,11 @@
-- Copyright (C) 2017 yushi studio <ywb94@qq.com> github.com/ywb94
-- Copyright (C) 2018 lean <coolsnowwolf@gmail.com> github.com/coolsnowwolf
-- Licensed to the public under the GNU General Public License v3.
local m, s, sec, o, kcp_enable
local vssr = "vssr"
local gfwmode=0
local gfwmode = 0
if nixio.fs.access("/etc/dnsmasq.ssr/gfw_list.conf") then
gfwmode=1
end
if nixio.fs.access("/etc/dnsmasq.ssr/gfw_list.conf") then gfwmode = 1 end
local uci = luci.model.uci.cursor()
@ -21,80 +18,90 @@ local tw_table = {}
local tvb_table = {}
uci:foreach(vssr, "servers", function(s)
if s.alias then
server_table[s[".name"]] = "[%s]:%s" %{string.upper(s.type), s.alias}
server_table[s[".name"]] = "[%s]:%s" % {string.upper(s.type), s.alias}
elseif s.server and s.server_port then
server_table[s[".name"]] = "[%s]:%s:%s" %{string.upper(s.type), s.server, s.server_port}
server_table[s[".name"]] = "[%s]:%s:%s" %
{
string.upper(s.type), s.server, s.server_port
}
end
if s.flag == "tw" then
if s.alias then
tw_table[s[".name"]] = "[%s]:%s" %{string.upper(s.type), s.alias}
tw_table[s[".name"]] = "[%s]:%s" % {string.upper(s.type), s.alias}
elseif s.server and s.server_port then
tw_table[s[".name"]] = "[%s]:%s:%s" %{string.upper(s.type), s.server, s.server_port}
tw_table[s[".name"]] = "[%s]:%s:%s" %
{
string.upper(s.type), s.server, s.server_port
}
end
end
if s.flag == "hk" then
if s.alias then
tvb_table[s[".name"]] = "[%s]:%s" %{string.upper(s.type), s.alias}
tvb_table[s[".name"]] = "[%s]:%s" % {string.upper(s.type), s.alias}
elseif s.server and s.server_port then
tvb_table[s[".name"]] = "[%s]:%s:%s" %{string.upper(s.type), s.server, s.server_port}
tvb_table[s[".name"]] = "[%s]:%s:%s" %
{
string.upper(s.type), s.server, s.server_port
}
end
end
end)
local key_table = {}
for key,_ in pairs(server_table) do
table.insert(key_table,key)
end
for key, _ in pairs(server_table) do table.insert(key_table, key) end
local key_table_tw = {}
for key,_ in pairs(tw_table) do
table.insert(key_table_tw,key)
end
for key, _ in pairs(tw_table) do table.insert(key_table_tw, key) end
local key_table_tvb = {}
for key,_ in pairs(tvb_table) do
table.insert(key_table_tvb,key)
end
for key, _ in pairs(tvb_table) do table.insert(key_table_tvb, key) end
table.sort(key_table)
table.sort(key_table_tw)
table.sort(key_table_tvb)
local route_name = {"youtube_server","tw_video_server","netflix_server","disney_server","prime_server","tvb_server","custom_server"}
local route_label = {"Youtube Proxy","TaiWan Video Proxy","Netflix Proxy","Diseny+ Proxy","Prime Video Proxy","TVB Video Proxy","Custom Proxy"}
local route_name = {
"youtube_server", "tw_video_server", "netflix_server", "disney_server",
"prime_server", "tvb_server", "custom_server"
}
local route_label = {
"Youtube Proxy", "TaiWan Video Proxy", "Netflix Proxy", "Diseny+ Proxy",
"Prime Video Proxy", "TVB Video Proxy", "Custom Proxy"
}
-- [[ Global Setting ]]--
s = m:section(TypedSection, "global",translate("Basic Settings [SS|SSR|V2ray|Trojan]"))
s = m:section(TypedSection, "global",
translate("Basic Settings [SS|SSR|V2ray|Trojan]"))
s.anonymous = true
o = s:option(ListValue, "global_server", translate("Main Server"))
o:value("nil", translate("Disable"))
for _,key in pairs(key_table) do o:value(key,server_table[key]) end
for _, key in pairs(key_table) do o:value(key, server_table[key]) end
o.default = "nil"
o.rmempty = false
o = s:option(ListValue, "udp_relay_server", translate("Game Mode UDP Server"))
o:value("", translate("Disable"))
o:value("same", translate("Same as Main Server"))
for _,key in pairs(key_table) do o:value(key,server_table[key]) end
for _, key in pairs(key_table) do o:value(key, server_table[key]) end
o = s:option(Flag, "v2ray_flow", translate("Open v2ray route"))
o.rmempty = false
o.description = translate("When open v2ray routed,Apply may take more time.")
for i,v in pairs(route_name) do
for i, v in pairs(route_name) do
o = s:option(ListValue, v, translate(route_label[i]))
o:value("nil", translate("Same as Main Server"))
if(v == "tw_video_server") then
for _,key in pairs(key_table_tw) do o:value(key,tw_table[key]) end
elseif(v == "tvb_server") then
for _,key in pairs(key_table_tvb) do o:value(key,tvb_table[key]) end
if (v == "tw_video_server") then
for _, key in pairs(key_table_tw) do o:value(key, tw_table[key]) end
elseif (v == "tvb_server") then
for _, key in pairs(key_table_tvb) do
o:value(key, tvb_table[key])
end
else
for _,key in pairs(key_table) do o:value(key,server_table[key]) end
for _, key in pairs(key_table) do o:value(key, server_table[key]) end
end
o:depends("v2ray_flow", "1")
o.default = "nil"

View File

@ -9,37 +9,36 @@ s.anonymous = true
-- Part of WAN
s:tab("wan_ac", translate("WAN IP AC"))
o = s:taboption("wan_ac", DynamicList, "wan_bp_ips", translate("WAN White List IP"))
o = s:taboption("wan_ac", DynamicList, "wan_bp_ips",
translate("WAN White List IP"))
o.datatype = "ip4addr"
o = s:taboption("wan_ac", DynamicList, "wan_fw_ips", translate("WAN Force Proxy IP"))
o = s:taboption("wan_ac", DynamicList, "wan_fw_ips",
translate("WAN Force Proxy IP"))
o.datatype = "ip4addr"
-- Part of LAN
s:tab("lan_ac", translate("LAN IP AC"))
o = s:taboption("lan_ac", DynamicList, "lan_ac_ips", translate("LAN Bypassed Host List"))
o = s:taboption("lan_ac", DynamicList, "lan_ac_ips",
translate("LAN Bypassed Host List"))
o.datatype = "ipaddr"
luci.ip.neighbors({ family = 4 }, function(entry)
if entry.reachable then
o:value(entry.dest:string())
end
luci.ip.neighbors({family = 4}, function(entry)
if entry.reachable then o:value(entry.dest:string()) end
end)
o = s:taboption("lan_ac", DynamicList, "lan_fp_ips", translate("LAN Force Proxy Host List"))
o = s:taboption("lan_ac", DynamicList, "lan_fp_ips",
translate("LAN Force Proxy Host List"))
o.datatype = "ipaddr"
luci.ip.neighbors({ family = 4 }, function(entry)
if entry.reachable then
o:value(entry.dest:string())
end
luci.ip.neighbors({family = 4}, function(entry)
if entry.reachable then o:value(entry.dest:string()) end
end)
o = s:taboption("lan_ac", DynamicList, "lan_gm_ips", translate("Game Mode Host List"))
o = s:taboption("lan_ac", DynamicList, "lan_gm_ips",
translate("Game Mode Host List"))
o.datatype = "ipaddr"
luci.ip.neighbors({ family = 4 }, function(entry)
if entry.reachable then
o:value(entry.dest:string())
end
luci.ip.neighbors({family = 4}, function(entry)
if entry.reachable then o:value(entry.dest:string()) end
end)
-- Part of Self
@ -57,16 +56,11 @@ o = s:taboption("esc", TextValue, "escconf")
o.rows = 13
o.wrap = "off"
o.rmempty = true
o.cfgvalue = function(self, section)
return NXFS.readfile(escconf) or ""
end
o.cfgvalue = function(self, section) return NXFS.readfile(escconf) or "" end
o.write = function(self, section, value)
NXFS.writefile(escconf, value:gsub("\r\n", "\n"))
end
o.remove = function(self, section, value)
NXFS.writefile(escconf, "")
end
o.remove = function(self, section, value) NXFS.writefile(escconf, "") end
s:tab("block", translate("Black Domain List"))
@ -75,19 +69,16 @@ o = s:taboption("block", TextValue, "blockconf")
o.rows = 13
o.wrap = "off"
o.rmempty = true
o.cfgvalue = function(self, section)
return NXFS.readfile(blockconf) or " "
end
o.cfgvalue = function(self, section) return NXFS.readfile(blockconf) or " " end
o.write = function(self, section, value)
NXFS.writefile(blockconf, value:gsub("\r\n", "\n"))
end
o.remove = function(self, section, value)
NXFS.writefile(blockconf, "")
end
o.remove = function(self, section, value) NXFS.writefile(blockconf, "") end
s:tab("proxy", translate("Custom Proxy Domain Name"))
o = s:taboption("proxy", DynamicList, "proxy_domain_name", translate("Proxy Domain Name"))
o = s:taboption("proxy", DynamicList, "proxy_domain_name",
translate("Proxy Domain Name"))
o.datatype = "hostname"
return m

View File

@ -7,9 +7,10 @@ t = f:field(TextValue, "conf")
t.rmempty = true
t.rows = 20
function t.cfgvalue()
luci.sys.exec("[ -f /tmp/vssr.log ] && sed '1!G;h;$!d' /tmp/vssr.log > /tmp/ssrpro.log")
luci.sys.exec(
"[ -f /tmp/vssr.log ] && sed '1!G;h;$!d' /tmp/vssr.log > /tmp/ssrpro.log")
return fs.readfile(conffile) or ""
end
t.readonly="readonly"
t.readonly = "readonly"
return f

View File

@ -1,44 +1,20 @@
-- Copyright (C) 2017 yushi studio <ywb94@qq.com>
-- Licensed to the public under the GNU General Public License v3.
local m, s, o
local vssr = "vssr"
local sid = arg[1]
local encrypt_methods = {
"rc4-md5",
"rc4-md5-6",
"rc4",
"table",
"aes-128-cfb",
"aes-192-cfb",
"aes-256-cfb",
"aes-128-ctr",
"aes-192-ctr",
"aes-256-ctr",
"bf-cfb",
"camellia-128-cfb",
"camellia-192-cfb",
"camellia-256-cfb",
"cast5-cfb",
"des-cfb",
"idea-cfb",
"rc2-cfb",
"seed-cfb",
"salsa20",
"chacha20",
"chacha20-ietf",
"rc4-md5", "rc4-md5-6", "rc4", "table", "aes-128-cfb", "aes-192-cfb",
"aes-256-cfb", "aes-128-ctr", "aes-192-ctr", "aes-256-ctr", "bf-cfb",
"camellia-128-cfb", "camellia-192-cfb", "camellia-256-cfb", "cast5-cfb",
"des-cfb", "idea-cfb", "rc2-cfb", "seed-cfb", "salsa20", "chacha20",
"chacha20-ietf"
}
local protocol = {
"origin",
}
local protocol = {"origin"}
obfs = {
"plain",
"http_simple",
"http_post",
}
obfs = {"plain", "http_simple", "http_post"}
m = Map(vssr, translate("Edit vssr Server"))
@ -48,9 +24,6 @@ if m.uci:get(vssr, sid) ~= "server_config" then
return
end
-- [[ Server Setting ]]--
s = m:section(NamedSection, sid, "server_config")
s.anonymous = true
@ -82,7 +55,6 @@ o = s:option(ListValue, "protocol", translate("Protocol"))
for _, v in ipairs(protocol) do o:value(v) end
o.rmempty = false
o = s:option(ListValue, "obfs", translate("Obfs"))
for _, v in ipairs(obfs) do o:value(v) end
o.rmempty = false

View File

@ -1,67 +1,34 @@
-- Copyright (C) 2017 yushi studio <ywb94@qq.com>
-- Licensed to the public under the GNU General Public License v3.
local m, sec, o
local vssr = "vssr"
local uci = luci.model.uci.cursor()
local ipkg = require("luci.model.ipkg")
m = Map(vssr, translate("vssr Server"))
local encrypt_methods = {
"table",
"rc4",
"rc4-md5",
"rc4-md5-6",
"aes-128-cfb",
"aes-192-cfb",
"aes-256-cfb",
"aes-128-ctr",
"aes-192-ctr",
"aes-256-ctr",
"bf-cfb",
"camellia-128-cfb",
"camellia-192-cfb",
"camellia-256-cfb",
"cast5-cfb",
"des-cfb",
"idea-cfb",
"rc2-cfb",
"seed-cfb",
"salsa20",
"chacha20",
"chacha20-ietf",
"table", "rc4", "rc4-md5", "rc4-md5-6", "aes-128-cfb", "aes-192-cfb",
"aes-256-cfb", "aes-128-ctr", "aes-192-ctr", "aes-256-ctr", "bf-cfb",
"camellia-128-cfb", "camellia-192-cfb", "camellia-256-cfb", "cast5-cfb",
"des-cfb", "idea-cfb", "rc2-cfb", "seed-cfb", "salsa20", "chacha20",
"chacha20-ietf"
}
local protocol = {
"origin",
"verify_deflate",
"auth_sha1_v4",
"auth_aes128_sha1",
"auth_aes128_md5",
"auth_chain_a",
"origin", "verify_deflate", "auth_sha1_v4", "auth_aes128_sha1",
"auth_aes128_md5", "auth_chain_a"
}
obfs = {
"plain",
"http_simple",
"http_post",
"random_head",
"tls1.2_ticket_auth",
"tls1.2_ticket_fastauth",
"plain", "http_simple", "http_post", "random_head", "tls1.2_ticket_auth",
"tls1.2_ticket_fastauth"
}
-- [[ Global Setting ]]--
sec = m:section(TypedSection, "server_global", translate("Global Setting"))
sec.anonymous = true
o = sec:option(Flag, "enable_server", translate("Enable Server"))
o.rmempty = false
@ -80,16 +47,11 @@ function sec.create(...)
end
o = sec:option(Flag, "enable", translate("Enable"))
function o.cfgvalue(...)
return Value.cfgvalue(...) or translate("0")
end
function o.cfgvalue(...) return Value.cfgvalue(...) or translate("0") end
o.rmempty = false
o = sec:option(DummyValue, "server_port", translate("Server Port"))
function o.cfgvalue(...)
return Value.cfgvalue(...) or "?"
end
function o.cfgvalue(...) return Value.cfgvalue(...) or "?" end
o = sec:option(DummyValue, "encrypt_method", translate("Encrypt Method"))
function o.cfgvalue(...)
@ -98,17 +60,9 @@ function o.cfgvalue(...)
end
o = sec:option(DummyValue, "protocol", translate("Protocol"))
function o.cfgvalue(...)
return Value.cfgvalue(...) or "?"
end
function o.cfgvalue(...) return Value.cfgvalue(...) or "?" end
o = sec:option(DummyValue, "obfs", translate("Obfs"))
function o.cfgvalue(...)
return Value.cfgvalue(...) or "?"
end
function o.cfgvalue(...) return Value.cfgvalue(...) or "?" end
return m

View File

@ -2,39 +2,36 @@ local vssr = "vssr"
local uci = luci.model.uci.cursor()
local server_table = {}
local sys = require "luci.sys"
m = Map(vssr)
-- [[ SOCKS5 Proxy ]]--
if nixio.fs.access("/usr/bin/v2ray/v2ray") then
s = m:section(TypedSection, "socks5_proxy", translate("V2ray SOCKS5 Proxy"))
s.anonymous = true
s = m:section(TypedSection, "socks5_proxy", translate("V2ray SOCKS5 Proxy"))
s.anonymous = true
o = s:option(Flag, "enable_server", translate("Enable Servers"))
o.rmempty = false
o = s:option(Flag, "enable_server", translate("Enable Servers"))
o.rmempty = false
o = s:option(Flag, "enable_auth", translate("Enable Auth"))
o.rmempty = false
o = s:option(Flag, "enable_auth", translate("Enable Auth"))
o.rmempty = false
o = s:option(Value, "Socks_user", translate("Socks user"))
o.default="user"
o.rmempty = true
o:depends("enable_auth", "1")
o = s:option(Value, "Socks_pass", translate("Socks pass"))
o.default="password"
o.password = true
o.rmempty = true
o:depends("enable_auth", "1")
o = s:option(Value, "local_port", translate("Local Port"))
o.datatype = "port"
o.default = 1080
o.rmempty = false
o = s:option(Value, "Socks_user", translate("Socks user"))
o.default = "user"
o.rmempty = true
o:depends("enable_auth", "1")
o = s:option(Value, "Socks_pass", translate("Socks pass"))
o.default = "password"
o.password = true
o.rmempty = true
o:depends("enable_auth", "1")
o = s:option(Value, "local_port", translate("Local Port"))
o.datatype = "port"
o.default = 1080
o.rmempty = false
end

View File

@ -11,7 +11,8 @@
<a href="https://www.maxmind.com">https://www.maxmind.com</a>.</p>
<h4 id="vssr_status"><span class="green" style="color: #404040;">Flag-icon-css</span></h4>
<p style="margin: 1rem; line-height: 1.8em;">A collection of all country flags in SVG — plus the CSS for easier integration <a href="https://flagicons.lipis.dev">https://flagicons.lipis.dev</a></p>
<p style="margin: 1rem; line-height: 1.8em;">A collection of all country flags in SVG — plus the CSS for
easier integration <a href="https://flagicons.lipis.dev">https://flagicons.lipis.dev</a></p>
</div>
</div>

View File

@ -52,7 +52,7 @@
str = padright(str, l, "=");
try {
return atob(str);
}catch(err) {
} catch (err) {
return str;
}
}
@ -209,7 +209,7 @@
var part2 = team[1].split(':');
var others = part2[1].split('?');
var queryParam = {}
if(others.length > 1) {
if (others.length > 1) {
var queryParams = others[1]
var queryArray = queryParams.split('&')
for (i = 0; i < queryArray.length; i++) {
@ -220,7 +220,7 @@
el('.server').value = part2[0];
el('.server_port').value = others[0];
el('.password').value = part1[1];
if(queryParam.peer || queryParam.sni){
if (queryParam.peer || queryParam.sni) {
el('.tls').checked = true;
el('.peer').value = queryParam.peer || queryParam.sni;
}

View File

@ -40,7 +40,6 @@
}
function wirte_status(data) {
if (data.outboard) {
json = data.outboardip;
country = (json.flag == "tw") ? "中国 台湾" : json.country;
@ -51,8 +50,7 @@
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");
setTimeout(function () { $( "body").trigger( "iploaded", [ true ] ); }, 200);
setTimeout(function () { $("body").trigger("iploaded", [true]); }, 200);
}
XHR.poll(10, CHECK_IP_URL, null,
function (x, data) {

View File

@ -1,4 +1,4 @@
<link rel="stylesheet" href="/luci-static/vssr/css/vssr.css?v=202000825-1">
<link rel="stylesheet" href="/luci-static/vssr/css/vssr.css?v=<%=math.random(1,100000)%>">
<script src="<%=media%>/js/jquery.min.js"></script>

View File

@ -1,6 +1,6 @@
<script type="text/javascript" src="/luci-static/vssr/emoji.js"></script>
<script type="text/javascript" src="/luci-static/vssr/sweetalert.js"></script>
<script type="text/javascript" src="/luci-static/vssr/polyfill.js"></script>
<script type="text/javascript" src="/luci-static/vssr/emoji.js?v=1.16"></script>
<script type="text/javascript" src="/luci-static/vssr/sweetalert.js?v=1.16"></script>
<script type="text/javascript" src="/luci-static/vssr/polyfill.js?v=1.16"></script>
<!-- tblsection -->
<fieldset class="cbi-section" id="cbi-<%=self.config%>-<%=self.sectiontype%>">
@ -106,7 +106,7 @@
$(id).addClass("fast");
}
val.flag = (val.flag == undefined) ? "un" : val.flag;
$(id).attr("data-flag",val.flag);
$(id).attr("data-flag", val.flag);
$(id).find(".type .tp").text(val.type);
$(id).find(".type").addClass("flag-icon-" + val.flag);
$(id).find(".alias").text(val.alias);
@ -135,49 +135,48 @@
//切换节点
function apply_node(node) {
//$("#cbi-apply-vssr1").show(); //显示应用中
var $html = "";
$html +='<div class="pure-g choose_node">';
$html +='<div class="pure-u-1-2"><div class="gap"><button class="cbi-button cbi-button-apply change-node" data-server="global" data-node="'+node+'"> 主服务器 </button></div></div>';
$html +='<div class="pure-u-1-2"><div class="gap"><button class="cbi-button cbi-button-apply change-node" data-server="youtube" data-node="'+node+'"> Youtube </button></div></div>';
if($('#cbi-' + CONFIG + '-' +node).attr("data-flag") == "tw"){
$html +='<div class="pure-u-1-2"><div class="gap"><button class="cbi-button cbi-button-apply change-node" data-server="tw_video" data-node="'+node+'"> TW Video </button></div></div>';
$html += '<div class="pure-g choose_node">';
$html += '<div class="pure-u-1-2"><div class="gap"><button class="cbi-button cbi-button-apply change-node" data-server="global" data-node="' + node + '"> 主服务器 </button></div></div>';
$html += '<div class="pure-u-1-2"><div class="gap"><button class="cbi-button cbi-button-apply change-node" data-server="udp_relay" data-node="' + node + '"> UDP游戏模式 </button></div></div>';
$html += '<div class="pure-u-1-2"><div class="gap"><button class="cbi-button cbi-button-apply change-node" data-server="youtube" data-node="' + node + '"> Youtube </button></div></div>';
if ($('#cbi-' + CONFIG + '-' + node).attr("data-flag") == "tw") {
$html += '<div class="pure-u-1-2"><div class="gap"><button class="cbi-button cbi-button-apply change-node" data-server="tw_video" data-node="' + node + '"> TW Video </button></div></div>';
}
$html +='<div class="pure-u-1-2"><div class="gap"><button class="cbi-button cbi-button-apply change-node" data-server="netflix" data-node="'+node+'"> Netflix </button></div></div>';
$html +='<div class="pure-u-1-2"><div class="gap"><button class="cbi-button cbi-button-apply change-node" data-server="disney" data-node="'+node+'"> Diseny+ </button></div></div>';
$html +='<div class="pure-u-1-2"><div class="gap"><button class="cbi-button cbi-button-apply change-node" data-server="prime" data-node="'+node+'"> Prime Video </button></div></div>';
if($('#cbi-' + CONFIG + '-' +node).attr("data-flag") =="hk"){
$html +='<div class="pure-u-1-2"><div class="gap"><button class="cbi-button cbi-button-apply change-node" data-server="tvb" data-node="'+node+'"> TVB Video </button></div></div>';
$html += '<div class="pure-u-1-2"><div class="gap"><button class="cbi-button cbi-button-apply change-node" data-server="netflix" data-node="' + node + '"> Netflix </button></div></div>';
$html += '<div class="pure-u-1-2"><div class="gap"><button class="cbi-button cbi-button-apply change-node" data-server="disney" data-node="' + node + '"> Diseny+ </button></div></div>';
$html += '<div class="pure-u-1-2"><div class="gap"><button class="cbi-button cbi-button-apply change-node" data-server="prime" data-node="' + node + '"> Prime Video </button></div></div>';
if ($('#cbi-' + CONFIG + '-' + node).attr("data-flag") == "hk") {
$html += '<div class="pure-u-1-2"><div class="gap"><button class="cbi-button cbi-button-apply change-node" data-server="tvb" data-node="' + node + '"> TVB Video </button></div></div>';
}
$html +='<div class="pure-u-1-2"><div class="gap"><button class="cbi-button cbi-button-apply change-node" data-server="custom" data-node="'+node+'"> 自定义 </button></div></div>';
$html +='</div>';
$html += '<div class="pure-u-1-2"><div class="gap"><button class="cbi-button cbi-button-apply change-node" data-server="custom" data-node="' + node + '"> 自定义 </button></div></div>';
$html += '</div>';
Swal.fire({
title: '请选择应用于',
html:$html,
html: $html,
focusConfirm: false,
confirmButtonText:'关闭',
confirmButtonText: '关闭',
onRender: (toast) => {
$(".change-node").click(function(){
$(".change-node").click(function () {
var dataServer = $(this).attr("data-server");
XHR.halt();
$.each(ajaxArray, function (n, value) { value.abort(); }) //中断所有的ajax请求
Swal.fire({
title: '正在应用中',
allowOutsideClick:false,
allowOutsideClick: false,
onBeforeOpen: () => {
Swal.showLoading()
}
})
$.get(CHANGE_NODE_URL, { set: node,server:dataServer },
$.get(CHANGE_NODE_URL, { set: node, server: dataServer },
function (data, status) {
$("#cbi-apply-vssr1").hide(); //隐藏应用中
if (data.status) {
var id = '#cbi-<%=self.config%>-' + node;
if(dataServer == "global"){
if (dataServer == "global") {
$(".cbi-section-table-row").removeClass("fast");
$(id).addClass("fast");
}
Swal.close();
XHR.run();
}
@ -185,35 +184,21 @@
})
}
})
/*$.get(CHANGE_NODE_URL, { set: node },
function (data, status) {
$("#cbi-apply-vssr1").hide(); //隐藏应用中
if (data.status) {
var id = '#cbi-<%=self.config%>-' + node;
$(".cbi-section-table-row").removeClass("fast");
$(id).addClass("fast");
}
});*/
}
//设定自动切换台
//设定自动切换
$(".incon").click(function () {
$.each(ajaxArray, function (n, value) { value.abort(); }) //中断所有的ajax请求
$node_switch_icon = $(this).find(".pure-imgw");
$node_target = $(this).attr("data-setction");
$.post(SWITCH_NODE_URL, { node: $node_target }, function (data) {
if(data.status){
if(data.switch){
if (data.status) {
if (data.switch) {
$node_switch_icon.removeClass("hidden");
}else{
} else {
$node_switch_icon.addClass("hidden");
}
}else{
} else {
alert("请求出错!")
}
}, "json");
@ -230,10 +215,9 @@
host = $(this).find(".cbi-section-table-row ").attr("server");
port = $(this).find(".cbi-section-table-row ").attr("server_port");
$(".host_con").text("");
if(host != undefined){
if (host != undefined) {
check_port(host, port, this);
}
});
}
@ -242,7 +226,7 @@
$.ajaxSettings.async = true;
var axhr = $.get(CHECK_PING_URL, { host: hosts, port: ports },
function (data, status) {
currentCheckCount ++
currentCheckCount++
var host_con = $(target).find(".host_con");
host_con.removeClass("fast");
host_con.removeClass("middle");
@ -267,7 +251,7 @@
host_con.text("Error");
}
if(currentCheckCount == ajaxArray.length){
if (currentCheckCount == ajaxArray.length) {
XHR.run();
}
});
@ -275,10 +259,8 @@
}
$(document).ready(function () {
//setTimeout(function () { check(); }, 500); //延迟500MS开始检测
$( "body" ).on( "iploaded", function( event, param1 ) {
if(!iploaded){
$("body").on("iploaded", function (event, param1) {
if (!iploaded) {
iploaded = true;
check();
}

View File

@ -1,9 +1,9 @@
<%+cbi/valueheader%>
<link rel="stylesheet" href="/luci-static/vssr/css/vssr.css?v=72883">
<link rel="stylesheet" href="/luci-static/vssr/css/vssr.css?v=<%=math.random(1,100000)%>">
<label class="cbi-value-title"><%= translate("Update") %></label>
<div class="cbi-value-field">
<input class="cbi-button cbi-button-reload" id="update_subscribe" type="button"
size="0" value="<%= translate("Save And Start Subscribe") %>">
<input class="cbi-button cbi-button-reload" id="update_subscribe" type="button" size="0"
value="<%= translate("Save And Start Subscribe") %>">
</div>
<script type="text/javascript">

View File

@ -479,8 +479,8 @@ msgstr "游戏模式UDP中继"
msgid "Server failsafe auto swith settings"
msgstr "服务器节点故障自动切换设置"
msgid "Delete all severs"
msgstr "删除所有服务器"
msgid "Delete All Subscribe Severs"
msgstr "删除所有订阅服务器"
msgid "Severs Nodes"
msgstr "节点列表"

View File

@ -39,7 +39,7 @@ usage() {
-g gfw list mode
-r return china mode
-h show this help message and exit
EOF
EOF
exit $1
}
@ -112,7 +112,7 @@ ipset_r() {
esac
ipset -N fplan hash:net 2>/dev/null
for ip in $LAN_FP_IP; do ipset -! add fplan $ip ; done
for ip in $LAN_FP_IP; do ipset -! add fplan $ip; done
$IPT -I SS_SPEC_WAN_AC -m set --match-set fplan src -j SS_SPEC_WAN_FW
ipset -N whitelist hash:net 2>/dev/null
@ -174,8 +174,8 @@ ac_rule() {
create ssr_gen_router hash:net
$(gen_spec_iplist | sed -e "s/^/add ssr_gen_router /")
EOF
$IPT -N SS_SPEC_ROUTER && \
$IPT -A SS_SPEC_ROUTER -m set --match-set ssr_gen_router dst -j RETURN && \
$IPT -N SS_SPEC_ROUTER &&
$IPT -A SS_SPEC_ROUTER -m set --match-set ssr_gen_router dst -j RETURN &&
$IPT -A SS_SPEC_ROUTER -j SS_SPEC_WAN_FW
$IPT -I OUTPUT 1 -p tcp -m comment --comment "$TAG" -j SS_SPEC_ROUTER
fi
@ -286,7 +286,7 @@ gen_include() {
[ -n "$FWI" ] || return 0
extract_rules() {
echo "*$1"
iptables-save -t $1 | grep SS_SPEC_ |\
iptables-save -t $1 | grep SS_SPEC_ |
sed -e "s/^-A \(OUTPUT\|PREROUTING\)/-I \1 1/"
echo 'COMMIT'
}
@ -296,7 +296,7 @@ gen_include() {
$(extract_rules nat)
$(extract_rules mangle)
EOT
EOF
EOF
return 0
}

View File

@ -98,11 +98,15 @@ function _M.get_flag(remark, host)
end
end
if (iso_code == nil) then
if (iso_code == nil ) then
if( host ~= "") then
local ret = nixio.getaddrinfo(host, "any")
local hostip = ret[1].address
local res = db:lookup(hostip)
iso_code = string.lower(res:get("country", "iso_code"))
else
iso_code = "un"
end
end
return string.gsub(iso_code, '\n', '')
end
@ -119,16 +123,15 @@ function _M.check_site(host, port)
return ret
end
function _M.trim(text)
if not text or text == "" then
return ""
end
if not text or text == "" then return "" end
return (string.gsub(text, "^%s*(.-)%s*$", "%1"))
end
function _M.wget(url)
local stdout = luci.sys.exec('wget-ssl -q --user-agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36" --no-check-certificate -t 3 -T 10 -O- "' .. url .. '"')
local stdout = luci.sys.exec(
'wget-ssl -q --user-agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36" --no-check-certificate -t 3 -T 10 -O- "' ..
url .. '"')
return _M.trim(stdout)
end

View File

@ -1,5 +1,5 @@
echo "create china hash:net family inet hashsize 1024 maxelem 65536" > /tmp/china.ipset
awk '!/^$/&&!/^#/{printf("add china %s'" "'\n",$0)}' /etc/china_ssr.txt >> /tmp/china.ipset
echo "create china hash:net family inet hashsize 1024 maxelem 65536" >/tmp/china.ipset
awk '!/^$/&&!/^#/{printf("add china %s'" "'\n",$0)}' /etc/china_ssr.txt >>/tmp/china.ipset
ipset -! flush china
ipset -! restore < /tmp/china.ipset 2>/dev/null
ipset -! restore </tmp/china.ipset 2>/dev/null
rm -f /tmp/china.ipset

View File

@ -1,4 +1,4 @@
local ucursor = require "luci.model.uci".cursor()
local ucursor = require"luci.model.uci".cursor()
local json = require "luci.jsonc"
local server_section = arg[1]
local proto = arg[2]
@ -18,6 +18,6 @@ local ss = {
reuse_port = true,
fast_open = (server.fast_open == "1") and true or false,
plugin = (server.plugin ~= nil) and server.plugin or nil,
plugin_opts = (server.plugin ~= nil) and server.plugin_opts or nil,
plugin_opts = (server.plugin ~= nil) and server.plugin_opts or nil
}
print(json.stringify(ss, 1))

View File

@ -1,4 +1,4 @@
local ucursor = require "luci.model.uci".cursor()
local ucursor = require"luci.model.uci".cursor()
local json = require "luci.jsonc"
local server_section = arg[1]
local proto = arg[2]
@ -20,6 +20,6 @@ local ssr = {
obfs = server.obfs,
obfs_param = server.obfs_param,
reuse_port = true,
fast_open = (server.fast_open == "1") and true or false,
fast_open = (server.fast_open == "1") and true or false
}
print(json.stringify(ssr, 1))

View File

@ -1,4 +1,4 @@
local ucursor = require "luci.model.uci".cursor()
local ucursor = require"luci.model.uci".cursor()
local json = require "luci.jsonc"
local server_section = arg[1]
local proto = arg[2]
@ -27,7 +27,7 @@ local trojan = {
alpn = {"h2", "http/1.1"},
curve = "",
reuse_session = true,
session_ticket = false,
session_ticket = false
},
tcp = {
no_delay = true,

View File

@ -15,7 +15,8 @@ local disney_server = ucursor:get_first(name, 'global', 'disney_server')
local prime_server = ucursor:get_first(name, 'global', 'prime_server')
local tvb_server = ucursor:get_first(name, 'global', 'tvb_server')
local custom_server = ucursor:get_first(name, 'global', 'custom_server')
local proxy_domain_name = ucursor:get_list(name,"@access_control[0]","proxy_domain_name")
local proxy_domain_name = ucursor:get_list(name, "@access_control[0]",
"proxy_domain_name")
function gen_outbound(server_node, tags, local_ports)
local bound = {}
@ -30,10 +31,7 @@ function gen_outbound(server_node, tags, local_ports)
protocol = "socks",
settings = {
servers = {
{
address = "127.0.0.1",
port = tonumber(local_ports)
}
{address = "127.0.0.1", port = tonumber(local_ports)}
}
}
}
@ -61,7 +59,8 @@ function gen_outbound(server_node, tags, local_ports)
network = server.transport,
security = (server.tls == '1') and "tls" or "none",
tlsSettings = {
allowInsecure = (server.insecure == "1") and true or false,
allowInsecure = (server.insecure == "1") and true or
false,
serverName = server.ws_host
},
kcpSettings = (server.transport == "kcp") and {
@ -69,7 +68,8 @@ function gen_outbound(server_node, tags, local_ports)
tti = tonumber(server.tti),
uplinkCapacity = tonumber(server.uplink_capacity),
downlinkCapacity = tonumber(server.downlink_capacity),
congestion = (server.congestion == "1") and true or false,
congestion = (server.congestion == "1") and true or
false,
readBufferSize = tonumber(server.read_buffer_size),
writeBufferSize = tonumber(server.write_buffer_size),
header = {type = server.kcp_guise}
@ -100,18 +100,18 @@ end
local outbounds_table = {}
if v2ray_flow == "1" then
table.insert(outbounds_table, gen_outbound(server_section, "global",2080))
table.insert(outbounds_table, gen_outbound(youtube_server, "youtube",2081))
table.insert(outbounds_table, gen_outbound(tw_video_server, "twvideo",2082))
table.insert(outbounds_table, gen_outbound(netflix_server, "netflix",2083))
table.insert(outbounds_table, gen_outbound(disney_server, "disney",2084))
table.insert(outbounds_table, gen_outbound(prime_server, "prime",2085))
table.insert(outbounds_table, gen_outbound(tvb_server, "tvb",2086))
table.insert(outbounds_table, gen_outbound(custom_server, "custom",2087))
table.insert(outbounds_table, gen_outbound(server_section, "global", 2080))
table.insert(outbounds_table, gen_outbound(youtube_server, "youtube", 2081))
table.insert(outbounds_table, gen_outbound(tw_video_server, "twvideo", 2082))
table.insert(outbounds_table, gen_outbound(netflix_server, "netflix", 2083))
table.insert(outbounds_table, gen_outbound(disney_server, "disney", 2084))
table.insert(outbounds_table, gen_outbound(prime_server, "prime", 2085))
table.insert(outbounds_table, gen_outbound(tvb_server, "tvb", 2086))
table.insert(outbounds_table, gen_outbound(custom_server, "custom", 2087))
else
table.insert(outbounds_table, gen_outbound(server_section, "main",local_port))
table.insert(outbounds_table,
gen_outbound(server_section, "main", local_port))
end
-- rules gen
@ -119,20 +119,10 @@ end
local youtube_rule = {
type = "field",
domain = {
"youtube",
"ggpht.com",
"googlevideo.com",
"withyoutube.com",
"youtu.be",
"youtube-nocookie.com",
"youtube.com",
"youtubeeducation.com",
"youtubegaming.com",
"youtubei.googleapis.com",
"youtubekids.com",
"youtubemobilesupport.com",
"yt.be",
"ytimg.com"
"youtube", "ggpht.com", "googlevideo.com", "withyoutube.com",
"youtu.be", "youtube-nocookie.com", "youtube.com",
"youtubeeducation.com", "youtubegaming.com", "youtubei.googleapis.com",
"youtubekids.com", "youtubemobilesupport.com", "yt.be", "ytimg.com"
},
outboundTag = "youtube"
}
@ -140,15 +130,8 @@ local youtube_rule = {
local tw_video_rule = {
type = "field",
domain = {
"vidol.tv",
"hinet.net",
"books.com",
"litv.tv",
"pstatic.net",
"app-measurement.com",
"kktv.com.tw",
"gamer.com.tw",
"wetv.vip"
"vidol.tv", "hinet.net", "books.com", "litv.tv", "pstatic.net",
"app-measurement.com", "kktv.com.tw", "gamer.com.tw", "wetv.vip"
},
outboundTag = "twvideo"
}
@ -156,17 +139,9 @@ local tw_video_rule = {
local netflix_rule = {
type = "field",
domain = {
"fast.com",
"netflix.ca",
"netflix.com",
"netflix.net",
"netflixinvestor.com",
"netflixtechblog.com",
"nflxext.com",
"nflximg.com",
"nflximg.net",
"nflxsearch.net",
"nflxso.net",
"fast.com", "netflix.ca", "netflix.com", "netflix.net",
"netflixinvestor.com", "netflixtechblog.com", "nflxext.com",
"nflximg.com", "nflximg.net", "nflxsearch.net", "nflxso.net",
"nflxvideo.net"
},
@ -185,17 +160,9 @@ local disney_rule = {
local prime_rule = {
type = "field",
domain = {
"aiv-cdn.net",
"amazonaws.com",
"amazonvideo.com",
"llnwd.net",
"amazonprimevideos.com",
"amazonvideo.cc",
"prime-video.com",
"primevideo.cc",
"primevideo.com",
"primevideo.info",
"primevideo.org",
"aiv-cdn.net", "amazonaws.com", "amazonvideo.com", "llnwd.net",
"amazonprimevideos.com", "amazonvideo.cc", "prime-video.com",
"primevideo.cc", "primevideo.com", "primevideo.info", "primevideo.org",
"rimevideo.tv"
},
outboundTag = "prime"
@ -203,10 +170,7 @@ local prime_rule = {
local tvb_rule = {
type = "field",
domain = {
"tvsuper.com",
"tvb.com"
},
domain = {"tvsuper.com", "tvb.com"},
outboundTag = "tvb"
}
@ -259,7 +223,9 @@ local v2ray = {
protocol = "dokodemo-door",
settings = {network = proto, followRedirect = true},
sniffing = {enabled = true, destOverride = {"http", "tls"}},
streamSettings = {sockopt = { tproxy = (proto == "tcp") and "redirect" or "tproxy"}}
streamSettings = {
sockopt = {tproxy = (proto == "tcp") and "redirect" or "tproxy"}
}
}
},

View File

@ -1,4 +1,4 @@
local ucursor = require "luci.model.uci".cursor()
local ucursor = require"luci.model.uci".cursor()
local name = "vssr"
local json = require "luci.jsonc"
local proto = "socks"
@ -7,10 +7,9 @@ local local_port = ucursor:get_first(name, 'socks5_proxy', 'local_port')
local Socks_user = ucursor:get_first(name, 'socks5_proxy', 'Socks_user')
local Socks_pass = ucursor:get_first(name, 'socks5_proxy', 'Socks_pass')
local v2ray = {
log = {
--error = "/var/log/v2ray.log",
-- error = "/var/log/v2ray.log",
loglevel = "warning"
},
-- 传入连接
@ -19,24 +18,14 @@ local v2ray = {
protocol = proto,
settings = {
auth = (auth_type == '1') and "password" or "noauth",
accounts =(auth_type == "1") and {
{
user = (auth_type == '1') and Socks_user,
pass = Socks_pass
}
} or nil,
accounts = (auth_type == "1") and
{{user = (auth_type == '1') and Socks_user, pass = Socks_pass}} or
nil
}
},
-- 传出连接
outbound = {
protocol = "freedom"
},
outbound = {protocol = "freedom"},
-- 额外传出连接
outboundDetour = {
{
protocol = "blackhole",
tag = "blocked"
}
}
outboundDetour = {{protocol = "blackhole", tag = "blocked"}}
}
print(json.stringify(v2ray,1))
print(json.stringify(v2ray, 1))

View File

@ -3,23 +3,19 @@
mkdir -p /tmp/dnsmasq.ssr
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.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/'"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.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/'"whitelist"'\n",$0)}' /etc/config/white.list > /tmp/dnsmasq.ssr/whitelist_forward.conf
awk '!/^$/&&!/^#/{printf("ipset=/.%s/'"whitelist"'\n",$0)}' /etc/config/white.list >/tmp/dnsmasq.ssr/whitelist_forward.conf
function valid_ip()
{
function valid_ip() {
ip=$1
read_ip=$(echo $ip|awk -F. '$1<=255&&$2<=255&&$3<=255&&$4<=255{print "yes"}')
if echo $ip|grep -E '^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$' >/dev/null
then
if [ $read_ip == "yes" ]
then
read_ip=$(echo $ip | awk -F. '$1<=255&&$2<=255&&$3<=255&&$4<=255{print "yes"}')
if echo $ip | grep -E '^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$' >/dev/null; then
if [ $read_ip == "yes" ]; then
return 0
else
return 1
@ -38,7 +34,7 @@ function addWhiteList() {
if valid_ip $host; then
ipset -! add whitelist $host
else
[ ! -z "$host" ] && echo "ipset=/.$host/whitelist" >> /tmp/dnsmasq.ssr/whitelist_forward.conf
[ ! -z "$host" ] && echo "ipset=/.$host/whitelist" >>/tmp/dnsmasq.ssr/whitelist_forward.conf
fi
}

View File

@ -9,7 +9,6 @@ require 'luci.util'
require 'luci.jsonc'
require 'luci.sys'
-- these global functions are accessed all the time by the event handler
-- so caching them is worth the effort
local luci = luci
@ -263,13 +262,15 @@ local function processData(szType, content)
result.alias = alias
result.switch_enable = switch_enable
local vssrutil = require "vssrutil"
result.flag = vssrutil.get_flag(result.alias,result.server)
result.flag = vssrutil.get_flag(result.alias, result.server)
return result
end
-- wget
local function wget(url)
local stdout = luci.sys.exec('wget-ssl -q --user-agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36" --no-check-certificate -t 3 -T 10 -O- "' .. url .. '"')
local stdout = luci.sys.exec(
'wget-ssl -q --user-agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36" --no-check-certificate -t 3 -T 10 -O- "' ..
url .. '"')
return trim(stdout)
end

View File

@ -1,4 +1,5 @@
#!/usr/bin/lua
------------------------------------------------
-- This file is part of the luci-app-ssr-plus update.lua
-- By Mattraks
@ -7,29 +8,31 @@ require 'nixio'
require 'luci.util'
require 'luci.jsonc'
require 'luci.sys'
local icount =0
local icount = 0
local ucic = luci.model.uci.cursor()
local log = function(...)
print(os.date("%Y-%m-%d %H:%M:%S ") .. table.concat({ ... }, " "))
print(os.date("%Y-%m-%d %H:%M:%S ") .. table.concat({...}, " "))
end
log('正在更新【GFW列表】数据库')
if nixio.fs.access("/usr/bin/wget-ssl") then
refresh_cmd="wget-ssl --no-check-certificate https://cdn.jsdelivr.net/gh/gfwlist/gfwlist/gfwlist.txt -O /tmp/gfw.b64"
else
refresh_cmd="wget -O /tmp/gfw.b64 http://iytc.net/tools/list.b64"
end
sret=luci.sys.call(refresh_cmd .. " 2>/dev/null")
if sret== 0 then
refresh_cmd =
"wget-ssl --no-check-certificate https://cdn.jsdelivr.net/gh/gfwlist/gfwlist/gfwlist.txt -O /tmp/gfw.b64"
else
refresh_cmd = "wget -O /tmp/gfw.b64 http://iytc.net/tools/list.b64"
end
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) > 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")
-- retstring=tostring(math.ceil(tonumber(icount)/2))
log('更新成功! 新的总纪录数:'.. icount)
luci.sys
.exec("cp -f /tmp/gfwnew.txt /etc/dnsmasq.ssr/gfw_list.conf")
-- retstring=tostring(math.ceil(tonumber(icount)/2))
log('更新成功! 新的总纪录数:' .. icount)
else
log('你已经是最新数据,无需更新!')
end
@ -42,17 +45,18 @@ else
end
log('正在更新【国内IP段】数据库')
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"
sret=luci.sys.call(refresh_cmd)
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"
sret = luci.sys.call(refresh_cmd)
icount = luci.sys.exec("cat /tmp/china_ssr.txt | wc -l")
if sret== 0 then
if sret == 0 then
icount = luci.sys.exec("cat /tmp/china_ssr.txt | wc -l")
if tonumber(icount)>1000 then
oldcount=luci.sys.exec("cat /etc/china_ssr.txt | wc -l")
if 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(math.ceil(tonumber(icount)/2))
log('更新成功! 新的总纪录数:'.. icount)
-- retstring=tostring(math.ceil(tonumber(icount)/2))
log('更新成功! 新的总纪录数:' .. icount)
else
log('你已经是最新数据,无需更新!')
end
@ -66,33 +70,32 @@ end
-- --[[
if ucic:get_first('vssr', 'global', 'adblock', '') == '1' then
log('正在更新【广告屏蔽】数据库')
log('正在更新【广告屏蔽】数据库')
local need_process = 0
if nixio.fs.access("/usr/bin/wget-ssl") then
refresh_cmd="wget-ssl --no-check-certificate -O - https://easylist-downloads.adblockplus.org/easylistchina+easylist.txt > /tmp/adnew.conf"
refresh_cmd =
"wget-ssl --no-check-certificate -O - https://easylist-downloads.adblockplus.org/easylistchina+easylist.txt > /tmp/adnew.conf"
need_process = 1
else
refresh_cmd="wget -O /tmp/ad.conf http://iytc.net/tools/ad.conf"
end
sret=luci.sys.call(refresh_cmd .. " 2>/dev/null")
if sret== 0 then
if need_process == 1 then
luci.sys.call("/usr/bin/vssr-ad")
end
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
refresh_cmd = "wget -O /tmp/ad.conf http://iytc.net/tools/ad.conf"
end
sret = luci.sys.call(refresh_cmd .. " 2>/dev/null")
if sret == 0 then
if need_process == 1 then luci.sys.call("/usr/bin/vssr-ad") end
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")
-- retstring=tostring(math.ceil(tonumber(icount)))
if oldcount==0 then
-- retstring=tostring(math.ceil(tonumber(icount)))
if oldcount == 0 then
luci.sys.call("/etc/init.d/dnsmasq restart")
end
log('更新成功! 新的总纪录数:'.. icount)
log('更新成功! 新的总纪录数:' .. icount)
else
log('你已经是最新数据,无需更新!')
end
@ -100,8 +103,8 @@ if sret== 0 then
log('更新失败!')
end
luci.sys.exec("rm -f /tmp/ad.conf")
else
else
log('更新失败!')
end
end
end
-- --]]

View File

@ -1,5 +1,5 @@
@import url("flag-icon.min.css");
@import url("sweetalert2.css?v=2");
@import url("flag-icon.min.css?v=1.16");
@import url("sweetalert2.css?v=1.16");
/*!
Pure v1.0.1
Copyright 2013 Yahoo!
@ -251,7 +251,7 @@ https://github.com/pure-css/pure/blob/master/LICENSE.md
overflow-y: hidden;
border: 1px solid rgba(0, 0, 0, .05);
border-radius: .375rem;
background-color:#fff;
background-color: #fff;
box-shadow: 0 0 2rem 0 rgba(136, 152, 170, .15);
}
@ -259,14 +259,17 @@ https://github.com/pure-css/pure/blob/master/LICENSE.md
margin: 1rem;
}
.pure-img{
.pure-img {
max-height: 100%;
width: auto;
}
.pure-imgw{
.pure-imgw {
max-width: 100%;
height: auto;
}
.green {
font-size: 1.25rem;
color: #2dce89;
@ -308,10 +311,12 @@ https://github.com/pure-css/pure/blob/master/LICENSE.md
color: #8898aa !important;
line-height: 1.8em;
}
.p-in5{
.p-in5 {
padding: 8px;
}
.flag-icon:before{
.flag-icon:before {
position: absolute;
}
@ -330,19 +335,21 @@ https://github.com/pure-css/pure/blob/master/LICENSE.md
letter-spacing: normal;
}
.cbi-section-table-row:hover{
.cbi-section-table-row:hover {
background: #fff;
}
.cbi-section-table-row.fast{
.cbi-section-table-row.fast {
background: #5e72e4;
color: #fff;
}
.cbi-section-table-row.fast .ssr-button{
.cbi-section-table-row.fast .ssr-button {
color: #fff;
}
.cbi-section-table-row.fast .ssr-button:hover,
.cbi-section-table-row.fast .ssr-button:focus,
.cbi-section-table-row.fast .ssr-button:active {
@ -352,7 +359,7 @@ https://github.com/pure-css/pure/blob/master/LICENSE.md
box-shadow: none;
}
.cbi-section-table-row.fast .host_con{
.cbi-section-table-row.fast .host_con {
color: #fff !important;
}
@ -386,15 +393,18 @@ https://github.com/pure-css/pure/blob/master/LICENSE.md
}
.alias{
margin-bottom:1px;
.alias {
margin-bottom: 1px;
}
.incon{
.incon {
cursor: pointer;
}
.incon .pure-imgw{
.incon .pure-imgw {
transition: all 0.2s;
}
.incon:nth-child(2) {
position: absolute;
left: 0;
@ -406,7 +416,8 @@ https://github.com/pure-css/pure/blob/master/LICENSE.md
background-position: top;
}
.incon:nth-child(2) .tp{
.incon:nth-child(2) .tp {
position: absolute;
left: 0;
bottom: 0;
@ -492,48 +503,56 @@ https://github.com/pure-css/pure/blob/master/LICENSE.md
padding: 0.1rem 0.5rem;
border-radius: 0.2rem;
}
footer.mobile-hide{
footer.mobile-hide {
display: block;
}
.mar-10 {margin-left: 50px; margin-right: 10px;}
.mar-10 {
margin-left: 50px;
margin-right: 10px;
}
.status-bar{
.status-bar {
position: fixed;
bottom: 0;
right: 0;
box-shadow: 0 0 2rem 0 rgba(136,152,170,.3);
box-shadow: 0 0 2rem 0 rgba(136, 152, 170, .3);
color: #525f7f;
background: #fff;
z-index: 5;
box-sizing: border-box;
}
.status-bar .inner{
.status-bar .inner {
margin: 1em;
}
.status-bar .inner .flag{
.status-bar .inner .flag {
height: 3em;
display: block;
float: left;
margin-right: 1em;
}
.status-bar .inner .status-info{
.status-bar .inner .status-info {
font-weight: bold;
}
.status-bar .icon-con{
.status-bar .icon-con {
height: 3em;
text-align: right;
}
.choose_node .gap{
margin:0.5rem 1rem;
position:relative;
.choose_node .gap {
margin: 0.5rem 1rem;
position: relative;
}
.choose_node .gap .cbi-button{
width:100% !important;
.choose_node .gap .cbi-button {
width: 100% !important;
}
@media screen and (max-width: 2000px) {
.pure-u-1-5 {
width: 25%;
@ -589,8 +608,9 @@ footer.mobile-hide{
border-color: #fb6340 !important;
box-shadow: 0 0 1rem 0 rgba(136, 152, 170, .75);
}
.choose_node .pure-u-1-2{
width:50%;
.choose_node .pure-u-1-2 {
width: 50%;
}
}
@ -626,6 +646,8 @@ footer.mobile-hide{
.modals h2 {
padding: 0 !important;
background-color: transparent !important;
color: #fff !important;
}
.modals h3 {
@ -642,6 +664,7 @@ footer.mobile-hide{
height: calc(100% - 4rem);
font-family: 'Lucida Console';
font-size: 11px;
line-height: 1.5em;
background: transparent;
color: #FFFFFF;
outline: none;
@ -678,22 +701,25 @@ footer.mobile-hide{
left: 0;
top: 0;
}
.status-bar .pure-u-1-2{
.status-bar .pure-u-1-2 {
width: 50%;
}
.status-bar .inner .flag{
.status-bar .inner .flag {
height: 3em;
display: block;
float: left;
margin-right: 1em;
}
.status-bar .icon-con{
.status-bar .icon-con {
height: 2.5em;
text-align: right;
}
}
@media (prefers-color-scheme: dark) {
@media (prefers-color-scheme: dark) {
.block {
background-color: #3c3c3c !important;
box-shadow: 0 0 0.5rem 0 rgba(0, 0, 0, 0.35);
@ -704,11 +730,12 @@ footer.mobile-hide{
background-color: #3c3c3c !important;
box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.35);
}
.incon:nth-child(2) {
border-right: #1e1e1e 1px solid;
}
.ssr-button {
color: #ccc;
}
}
.ssr-button {
color: #ccc;
}
}