luci-app-vssr: bump to v1.17

This commit is contained in:
CN_SZTL 2020-08-27 21:54:27 +08:00
parent 2f7a30de71
commit 0c6420cdf0
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
5 changed files with 112 additions and 131 deletions

View File

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

View File

@ -104,20 +104,12 @@ function change_node()
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" 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.call("/etc/init.d/vssr restart >/www/restartlog.htm 2>&1")

View File

@ -13,6 +13,9 @@ function _M.get_flag(remark, host)
local ip = require "luci.ip"
local iso_table = {
"US", "US", "US", "US", "US", "HK", "HK", "TW", "TW", "TW", "TW", "TW",
"JP", "JP", "JP", "GB", "GB", "DE", "DE", "FR", "IN", "TR", "SG", "SG",
"KR", "KR", "KR", "KR", "RU", "IE", "CA", "CA", "AU", "CH", "AU", "AR","RU",
"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",
@ -34,11 +37,14 @@ function _M.get_flag(remark, host)
"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"
"XK", "YE", "YT", "ZA", "ZM", "ZW"
}
local emoji_table = {
"美国", "US", "洛杉矶","芝加哥","达拉斯", "香港","HK", "台湾", "TW", "TAIWAN","彰化","台北",
"日本", "JP", "JAPAN", "英国", "UK", "德国", "DE", "法国", "印度", "土耳其", "新加坡", "SG",
"韩国", "首尔", "KR", "KOREA", "俄罗斯", "爱尔兰", "CANADA", "加拿大","SYDNEY", "瑞士", "澳大利亚", "阿根廷","RU",
"🇦🇨", "🇦🇩", "🇦🇪", "🇦🇫", "🇦🇬", "🇦🇮",
"🇦🇱", "🇦🇲", "🇦🇴", "🇦🇶", "🇦🇷", "🇦🇸",
"🇦🇹", "🇦🇺", "🇦🇼", "🇦🇽", "🇦🇿", "🇧🇦",
@ -81,16 +87,13 @@ function _M.get_flag(remark, host)
"🇹🇼", "🇹🇿", "🇺🇦", "🇺🇬", "🇺🇲", "🇺🇳",
"🇺🇸", "🇺🇾", "🇺🇿", "🇻🇦", "🇻🇨", "🇻🇪",
"🇻🇬", "🇻🇮", "🇻🇳", "🇻🇺", "🇼🇫", "🇼🇸",
"🇽🇰", "🇾🇪", "🇾🇹", "🇿🇦", "🇿🇲", "🇿🇼",
"美国", "香港", "台湾", "日本", "英国", "UK", "德国",
"法国", "印度", "土耳其", "新加坡", "韩国", "俄罗斯",
"爱尔兰"
"🇽🇰", "🇾🇪", "🇾🇹", "🇿🇦", "🇿🇲", "🇿🇼"
}
local iso_code = nil
if (remark ~= nil) then
for i, v in pairs(emoji_table) do
if (string.find(remark, v)) then
if (string.find(string.lower(remark), string.lower(v))) then
iso_code = string.lower(iso_table[i])
break
end

View File

@ -7,20 +7,105 @@ local local_port = arg[3]
local host = arg[4]
local main_port = arg[5]
local outbounds_table = {}
local rules_table = {}
local v2ray_flow = ucursor:get_first(name, 'global', 'v2ray_flow', '0')
local youtube_server = ucursor:get_first(name, 'global', 'youtube_server')
local tw_video_server = ucursor:get_first(name, 'global', 'tw_video_server')
local netflix_server = ucursor:get_first(name, 'global', 'netflix_server')
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 flow_table = {
yotube = {
name = "youtube",
port = 2081,
rules = {
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"
},
outboundTag = "youtube"
}
},
tw_video = {
name = "tw_video",
port = 2082,
rules = {
type = "field",
domain = {
"vidol.tv", "hinet.net", "books.com", "litv.tv", "pstatic.net",
"app-measurement.com", "kktv.com.tw", "gamer.com.tw", "wetv.vip"
},
outboundTag = "twvideo"
}
},
netflix = {
name = "netflix",
port = 2083,
rules = {
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",
"nflxvideo.net"
},
outboundTag = "netflix"
}
},
disney = {
name = "disney",
port = 2084,
rules = {
type = "field",
domain = {
"cdn.registerdisney.go.com", "disneyplus.com",
"disney-plus.net", "dssott.com", "bamgrid.com",
"execute-api.us-east-1.amazonaws.com"
},
outboundTag = "disney"
}
},
prime = {
name = "prime",
port = 2085,
rules = {
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", "primevideo.tv"
},
outboundTag = "prime"
}
},
tvb = {
name = "tvb",
port = 2086,
rules = {
type = "field",
domain = {"tvsuper.com", "tvb.com"},
outboundTag = "tvb"
}
},
custom = {
name = "custom",
port = 2087,
rules = {
type = "field",
domain = proxy_domain_name,
outboundTag = "custom"
}
}
}
function gen_outbound(server_node, tags, local_ports)
local bound = {}
if server_node == "nil" then
if server_node == nil or server_node == "nil" then
bound = nil
else
@ -98,117 +183,17 @@ function gen_outbound(server_node, tags, local_ports)
return bound
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))
for i, v in pairs(flow_table) do
local server = ucursor:get_first(name, 'global', v.name..'_server')
table.insert(outbounds_table, gen_outbound(server, v.name,v.port))
table.insert(rules_table, (server ~=nil and server ~= "nil") and v.rules or nil)
end
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
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"
},
outboundTag = "youtube"
}
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"
},
outboundTag = "twvideo"
}
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",
"nflxvideo.net"
},
outboundTag = "netflix"
}
local disney_rule = {
type = "field",
domain = {
"cdn.registerdisney.go.com", "disneyplus.com", "disney-plus.net",
"dssott.com", "bamgrid.com", "execute-api.us-east-1.amazonaws.com"
},
outboundTag = "disney"
}
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",
"rimevideo.tv"
},
outboundTag = "prime"
}
local tvb_rule = {
type = "field",
domain = {"tvsuper.com", "tvb.com"},
outboundTag = "tvb"
}
local custom_rule = {
type = "field",
domain = proxy_domain_name,
outboundTag = "custom"
}
local rules_table = {}
if (youtube_server ~= "nil" and v2ray_flow == "1") then
table.insert(rules_table, youtube_rule)
end
if (tw_video_server ~= "nil" and v2ray_flow == "1") then
table.insert(rules_table, tw_video_rule)
end
if (netflix_server ~= "nil" and v2ray_flow == "1") then
table.insert(rules_table, netflix_rule)
end
if (disney_server ~= "nil" and v2ray_flow == "1") then
table.insert(rules_table, disney_rule)
end
if (prime_server ~= "nil" and v2ray_flow == "1") then
table.insert(rules_table, prime_rule)
end
if (tvb_server ~= "nil" and v2ray_flow == "1") then
table.insert(rules_table, tvb_rule)
end
if (custom_server ~= "nil" and v2ray_flow == "1") then
table.insert(rules_table, custom_rule)
end
local v2ray = {
log = {

View File

@ -335,6 +335,7 @@ local execute = function()
if result.alias:find("过期时间") or
result.alias:find("剩余流量") or
result.alias:find("QQ群") or
result.alias:find("不支持") or
result.alias:find("官网") or not result.server then
log('丢弃无效节点: ' .. result.type ..
' 节点, ' .. result.alias)