luci: complete #2959
This commit is contained in:
parent
797101f1bc
commit
082c935e7d
@ -6,18 +6,18 @@ local has_trojan_plus = api.is_finded("trojan-plus")
|
|||||||
local has_singbox = api.finded_com("singbox")
|
local has_singbox = api.finded_com("singbox")
|
||||||
local has_xray = api.finded_com("xray")
|
local has_xray = api.finded_com("xray")
|
||||||
local has_hysteria2 = api.finded_com("hysteria")
|
local has_hysteria2 = api.finded_com("hysteria")
|
||||||
local ss_aead_type = {}
|
local ss_type = {}
|
||||||
local trojan_type = {}
|
local trojan_type = {}
|
||||||
local vmess_type = {}
|
local vmess_type = {}
|
||||||
local vless_type = {}
|
local vless_type = {}
|
||||||
local hysteria2_type = {}
|
local hysteria2_type = {}
|
||||||
if has_ss then
|
if has_ss then
|
||||||
local s = "shadowsocks-libev"
|
local s = "shadowsocks-libev"
|
||||||
table.insert(ss_aead_type, s)
|
table.insert(ss_type, s)
|
||||||
end
|
end
|
||||||
if has_ss_rust then
|
if has_ss_rust then
|
||||||
local s = "shadowsocks-rust"
|
local s = "shadowsocks-rust"
|
||||||
table.insert(ss_aead_type, s)
|
table.insert(ss_type, s)
|
||||||
end
|
end
|
||||||
if has_trojan_plus then
|
if has_trojan_plus then
|
||||||
local s = "trojan-plus"
|
local s = "trojan-plus"
|
||||||
@ -26,7 +26,7 @@ end
|
|||||||
if has_singbox then
|
if has_singbox then
|
||||||
local s = "sing-box"
|
local s = "sing-box"
|
||||||
table.insert(trojan_type, s)
|
table.insert(trojan_type, s)
|
||||||
table.insert(ss_aead_type, s)
|
table.insert(ss_type, s)
|
||||||
table.insert(vmess_type, s)
|
table.insert(vmess_type, s)
|
||||||
table.insert(vless_type, s)
|
table.insert(vless_type, s)
|
||||||
table.insert(hysteria2_type, s)
|
table.insert(hysteria2_type, s)
|
||||||
@ -34,7 +34,7 @@ end
|
|||||||
if has_xray then
|
if has_xray then
|
||||||
local s = "xray"
|
local s = "xray"
|
||||||
table.insert(trojan_type, s)
|
table.insert(trojan_type, s)
|
||||||
table.insert(ss_aead_type, s)
|
table.insert(ss_type, s)
|
||||||
table.insert(vmess_type, s)
|
table.insert(vmess_type, s)
|
||||||
table.insert(vless_type, s)
|
table.insert(vless_type, s)
|
||||||
end
|
end
|
||||||
@ -60,9 +60,9 @@ o = s:option(DynamicList, "filter_discard_list", translate("Discard List"))
|
|||||||
|
|
||||||
o = s:option(DynamicList, "filter_keep_list", translate("Keep List"))
|
o = s:option(DynamicList, "filter_keep_list", translate("Keep List"))
|
||||||
|
|
||||||
if #ss_aead_type > 0 then
|
if #ss_type > 0 then
|
||||||
o = s:option(ListValue, "ss_aead_type", translatef("%s Node Use Type", "SS AEAD"))
|
o = s:option(ListValue, "ss_type", translatef("%s Node Use Type", "Shadowsocks"))
|
||||||
for key, value in pairs(ss_aead_type) do
|
for key, value in pairs(ss_type) do
|
||||||
o:value(value)
|
o:value(value)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -6,18 +6,18 @@ local has_trojan_plus = api.is_finded("trojan-plus")
|
|||||||
local has_singbox = api.finded_com("singbox")
|
local has_singbox = api.finded_com("singbox")
|
||||||
local has_xray = api.finded_com("xray")
|
local has_xray = api.finded_com("xray")
|
||||||
local has_hysteria2 = api.finded_com("hysteria")
|
local has_hysteria2 = api.finded_com("hysteria")
|
||||||
local ss_aead_type = {}
|
local ss_type = {}
|
||||||
local trojan_type = {}
|
local trojan_type = {}
|
||||||
local vmess_type = {}
|
local vmess_type = {}
|
||||||
local vless_type = {}
|
local vless_type = {}
|
||||||
local hysteria2_type = {}
|
local hysteria2_type = {}
|
||||||
if has_ss then
|
if has_ss then
|
||||||
local s = "shadowsocks-libev"
|
local s = "shadowsocks-libev"
|
||||||
table.insert(ss_aead_type, s)
|
table.insert(ss_type, s)
|
||||||
end
|
end
|
||||||
if has_ss_rust then
|
if has_ss_rust then
|
||||||
local s = "shadowsocks-rust"
|
local s = "shadowsocks-rust"
|
||||||
table.insert(ss_aead_type, s)
|
table.insert(ss_type, s)
|
||||||
end
|
end
|
||||||
if has_trojan_plus then
|
if has_trojan_plus then
|
||||||
local s = "trojan-plus"
|
local s = "trojan-plus"
|
||||||
@ -26,7 +26,7 @@ end
|
|||||||
if has_singbox then
|
if has_singbox then
|
||||||
local s = "sing-box"
|
local s = "sing-box"
|
||||||
table.insert(trojan_type, s)
|
table.insert(trojan_type, s)
|
||||||
table.insert(ss_aead_type, s)
|
table.insert(ss_type, s)
|
||||||
table.insert(vmess_type, s)
|
table.insert(vmess_type, s)
|
||||||
table.insert(vless_type, s)
|
table.insert(vless_type, s)
|
||||||
table.insert(hysteria2_type, s)
|
table.insert(hysteria2_type, s)
|
||||||
@ -34,7 +34,7 @@ end
|
|||||||
if has_xray then
|
if has_xray then
|
||||||
local s = "xray"
|
local s = "xray"
|
||||||
table.insert(trojan_type, s)
|
table.insert(trojan_type, s)
|
||||||
table.insert(ss_aead_type, s)
|
table.insert(ss_type, s)
|
||||||
table.insert(vmess_type, s)
|
table.insert(vmess_type, s)
|
||||||
table.insert(vless_type, s)
|
table.insert(vless_type, s)
|
||||||
end
|
end
|
||||||
@ -80,11 +80,11 @@ o:depends("filter_keyword_mode", "2")
|
|||||||
o:depends("filter_keyword_mode", "3")
|
o:depends("filter_keyword_mode", "3")
|
||||||
o:depends("filter_keyword_mode", "4")
|
o:depends("filter_keyword_mode", "4")
|
||||||
|
|
||||||
if #ss_aead_type > 0 then
|
if #ss_type > 0 then
|
||||||
o = s:option(ListValue, "ss_aead_type", translatef("%s Node Use Type", "SS AEAD"))
|
o = s:option(ListValue, "ss_type", translatef("%s Node Use Type", "Shadowsocks"))
|
||||||
o.default = "global"
|
o.default = "global"
|
||||||
o:value("global", translate("Use global config"))
|
o:value("global", translate("Use global config"))
|
||||||
for key, value in pairs(ss_aead_type) do
|
for key, value in pairs(ss_type) do
|
||||||
o:value(value)
|
o:value(value)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -29,7 +29,7 @@ local has_singbox = api.finded_com("singbox")
|
|||||||
local has_xray = api.finded_com("xray")
|
local has_xray = api.finded_com("xray")
|
||||||
local has_hysteria2 = api.finded_com("hysteria")
|
local has_hysteria2 = api.finded_com("hysteria")
|
||||||
local allowInsecure_default = nil
|
local allowInsecure_default = nil
|
||||||
local ss_aead_type_default = uci:get(appname, "@global_subscribe[0]", "ss_aead_type") or "shadowsocks-libev"
|
local ss_type_default = uci:get(appname, "@global_subscribe[0]", "ss_type") or "shadowsocks-libev"
|
||||||
local trojan_type_default = uci:get(appname, "@global_subscribe[0]", "trojan_type") or "trojan-plus"
|
local trojan_type_default = uci:get(appname, "@global_subscribe[0]", "trojan_type") or "trojan-plus"
|
||||||
local vmess_type_default = uci:get(appname, "@global_subscribe[0]", "vmess_type") or "xray"
|
local vmess_type_default = uci:get(appname, "@global_subscribe[0]", "vmess_type") or "xray"
|
||||||
local vless_type_default = uci:get(appname, "@global_subscribe[0]", "vless_type") or "xray"
|
local vless_type_default = uci:get(appname, "@global_subscribe[0]", "vless_type") or "xray"
|
||||||
@ -537,48 +537,46 @@ local function processData(szType, content, add_mode, add_from)
|
|||||||
result.method = method
|
result.method = method
|
||||||
result.password = password
|
result.password = password
|
||||||
|
|
||||||
local aead = false
|
if ss_type_default == "shadowsocks-rust" and has_ss_rust then
|
||||||
for k, v in ipairs({"aes-128-gcm", "aes-256-gcm", "chacha20-poly1305", "chacha20-ietf-poly1305"}) do
|
|
||||||
if method:lower() == v:lower() then
|
|
||||||
aead = true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if aead then
|
|
||||||
if ss_aead_type_default == "shadowsocks-libev" and has_ss then
|
|
||||||
result.type = "SS"
|
|
||||||
elseif ss_aead_type_default == "shadowsocks-rust" and has_ss_rust then
|
|
||||||
result.type = 'SS-Rust'
|
result.type = 'SS-Rust'
|
||||||
if method:lower() == "chacha20-poly1305" then
|
|
||||||
result.method = "chacha20-ietf-poly1305"
|
|
||||||
end
|
end
|
||||||
elseif ss_aead_type_default == "sing-box" and has_singbox and not result.plugin then
|
if ss_type_default == "xray" and has_xray then
|
||||||
result.type = 'sing-box'
|
|
||||||
result.protocol = 'shadowsocks'
|
|
||||||
elseif ss_aead_type_default == "xray" and has_xray and not result.plugin then
|
|
||||||
result.type = 'Xray'
|
result.type = 'Xray'
|
||||||
result.protocol = 'shadowsocks'
|
result.protocol = 'shadowsocks'
|
||||||
result.transport = 'tcp'
|
result.transport = 'tcp'
|
||||||
|
end
|
||||||
|
if ss_type_default == "sing-box" and has_singbox then
|
||||||
|
result.type = 'sing-box'
|
||||||
|
result.protocol = 'shadowsocks'
|
||||||
|
end
|
||||||
|
|
||||||
|
if result.type == "SS-Rust" or result.type == "Xray" then
|
||||||
if method:lower() == "chacha20-ietf-poly1305" then
|
if method:lower() == "chacha20-ietf-poly1305" then
|
||||||
result.method = "chacha20-poly1305"
|
result.method = "chacha20-poly1305"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if result.plugin then
|
||||||
|
if result.type == 'Xray' then
|
||||||
|
--不支持插件
|
||||||
|
result.error_msg = "Xray不支持插件."
|
||||||
end
|
end
|
||||||
|
if result.type == "sing-box" then
|
||||||
|
result.plugin_enabled = "1"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if result.type == "SS" then
|
||||||
|
local aead2022_methods = { "2022-blake3-aes-128-gcm", "2022-blake3-aes-256-gcm", "2022-blake3-chacha20-poly1305" }
|
||||||
local aead2022 = false
|
local aead2022 = false
|
||||||
for k, v in ipairs({"2022-blake3-aes-128-gcm", "2022-blake3-aes-256-gcm", "2022-blake3-chacha20-poly1305"}) do
|
for k, v in ipairs(aead2022_methods) do
|
||||||
if method:lower() == v:lower() then
|
if method:lower() == v:lower() then
|
||||||
aead2022 = true
|
aead2022 = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if aead2022 then
|
if aead2022 then
|
||||||
if ss_aead_type_default == "sing-box" and has_singbox and not result.plugin then
|
-- shadowsocks-libev 不支持2022加密
|
||||||
result.type = 'sing-box'
|
result.error_msg = "shadowsocks-libev 不支持2022加密."
|
||||||
result.protocol = 'shadowsocks'
|
|
||||||
elseif ss_aead_type_default == "xray" and has_xray and not result.plugin then
|
|
||||||
result.type = 'Xray'
|
|
||||||
result.protocol = 'shadowsocks'
|
|
||||||
result.transport = 'tcp'
|
|
||||||
elseif has_ss_rust then
|
|
||||||
result.type = 'SS-Rust'
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -1184,7 +1182,9 @@ local function parse_link(raw, add_mode, add_from)
|
|||||||
end
|
end
|
||||||
-- log(result)
|
-- log(result)
|
||||||
if result then
|
if result then
|
||||||
if not result.type then
|
if result.error_msg then
|
||||||
|
log('丢弃节点: ' .. result.remarks .. ", 原因:" .. result.error_msg)
|
||||||
|
elseif not result.type then
|
||||||
log('丢弃节点: ' .. result.remarks .. ", 找不到可使用二进制.")
|
log('丢弃节点: ' .. result.remarks .. ", 找不到可使用二进制.")
|
||||||
elseif (add_mode == "2" and is_filter_keyword(result.remarks)) or not result.address or result.remarks == "NULL" or result.address == "127.0.0.1" or
|
elseif (add_mode == "2" and is_filter_keyword(result.remarks)) or not result.address or result.remarks == "NULL" or result.address == "127.0.0.1" or
|
||||||
(not datatypes.hostname(result.address) and not (api.is_ip(result.address))) then
|
(not datatypes.hostname(result.address) and not (api.is_ip(result.address))) then
|
||||||
@ -1252,9 +1252,9 @@ local execute = function()
|
|||||||
filter_keyword_keep_list_default = value.filter_keep_list or {}
|
filter_keyword_keep_list_default = value.filter_keep_list or {}
|
||||||
filter_keyword_discard_list_default = value.filter_discard_list or {}
|
filter_keyword_discard_list_default = value.filter_discard_list or {}
|
||||||
end
|
end
|
||||||
local ss_aead_type = value.ss_aead_type or "global"
|
local ss_type = value.ss_type or "global"
|
||||||
if ss_aead_type ~= "global" then
|
if ss_type ~= "global" then
|
||||||
ss_aead_type_default = ss_aead_type
|
ss_type_default = ss_type
|
||||||
end
|
end
|
||||||
local trojan_type = value.trojan_type or "global"
|
local trojan_type = value.trojan_type or "global"
|
||||||
if trojan_type ~= "global" then
|
if trojan_type ~= "global" then
|
||||||
@ -1289,7 +1289,7 @@ local execute = function()
|
|||||||
filter_keyword_mode_default = uci:get(appname, "@global_subscribe[0]", "filter_keyword_mode") or "0"
|
filter_keyword_mode_default = uci:get(appname, "@global_subscribe[0]", "filter_keyword_mode") or "0"
|
||||||
filter_keyword_discard_list_default = uci:get(appname, "@global_subscribe[0]", "filter_discard_list") or {}
|
filter_keyword_discard_list_default = uci:get(appname, "@global_subscribe[0]", "filter_discard_list") or {}
|
||||||
filter_keyword_keep_list_default = uci:get(appname, "@global_subscribe[0]", "filter_keep_list") or {}
|
filter_keyword_keep_list_default = uci:get(appname, "@global_subscribe[0]", "filter_keep_list") or {}
|
||||||
ss_aead_type_default = uci:get(appname, "@global_subscribe[0]", "ss_aead_type") or "shadowsocks-libev"
|
ss_type_default = uci:get(appname, "@global_subscribe[0]", "ss_type") or "shadowsocks-libev"
|
||||||
trojan_type_default = uci:get(appname, "@global_subscribe[0]", "trojan_type") or "trojan-plus"
|
trojan_type_default = uci:get(appname, "@global_subscribe[0]", "trojan_type") or "trojan-plus"
|
||||||
vmess_type_default = uci:get(appname, "@global_subscribe[0]", "vmess_type") or "xray"
|
vmess_type_default = uci:get(appname, "@global_subscribe[0]", "vmess_type") or "xray"
|
||||||
vless_type_default = uci:get(appname, "@global_subscribe[0]", "vless_type") or "xray"
|
vless_type_default = uci:get(appname, "@global_subscribe[0]", "vless_type") or "xray"
|
||||||
|
Loading…
Reference in New Issue
Block a user