Sync 2026-04-22 04:42:14

This commit is contained in:
github-actions[bot]
2026-04-22 04:42:14 +08:00
parent 51e98c642e
commit cfcd70695f
17 changed files with 275 additions and 43 deletions
@@ -471,35 +471,35 @@ end
-- Processing data
local function processData(szType, content, add_mode, group, sub_cfg)
--log(2, content, add_mode, group)
local default_allowinsecure = DEFAULT_ALLOWINSECURE
local default_ss_type = DEFAULT_SS_TYPE
local default_trojan_type = DEFAULT_TROJAN_TYPE
local default_vmess_type = DEFAULT_VMESS_TYPE
local default_vless_type = DEFAULT_VLESS_TYPE
local default_hysteria2_type = DEFAULT_HYSTERIA2_TYPE
local sub_allowinsecure = DEFAULT_ALLOWINSECURE
local sub_ss_type = DEFAULT_SS_TYPE
local sub_trojan_type = DEFAULT_TROJAN_TYPE
local sub_vmess_type = DEFAULT_VMESS_TYPE
local sub_vless_type = DEFAULT_VLESS_TYPE
local sub_hysteria2_type = DEFAULT_HYSTERIA2_TYPE
if sub_cfg then
if sub_cfg.allowInsecure and sub_cfg.allowInsecure ~= "1" then
default_allowinsecure = nil
sub_allowinsecure = nil
end
local ss_type = sub_cfg.ss_type or "global"
if ss_type ~= "global" and core_has[ss_type] then
default_ss_type = ss_type
sub_ss_type = ss_type
end
local trojan_type = sub_cfg.trojan_type or "global"
if trojan_type ~= "global" and core_has[trojan_type] then
default_trojan_type = trojan_type
sub_trojan_type = trojan_type
end
local vmess_type = sub_cfg.vmess_type or "global"
if vmess_type ~= "global" and core_has[vmess_type] then
default_vmess_type = vmess_type
sub_vmess_type = vmess_type
end
local vless_type = sub_cfg.vless_type or "global"
if vless_type ~= "global" and core_has[vless_type] then
default_vless_type = vless_type
sub_vless_type = vless_type
end
local hysteria2_type = sub_cfg.hysteria2_type or "global"
if hysteria2_type ~= "global" and core_has[hysteria2_type] then
default_hysteria2_type = hysteria2_type
sub_hysteria2_type = hysteria2_type
end
end
local result = {
@@ -541,15 +541,14 @@ local function processData(szType, content, add_mode, group, sub_cfg)
result.remarks = base64Decode(params.remarks)
elseif szType == 'vmess' then
local info = jsonParse(content)
if default_vmess_type == "sing-box" and has_singbox then
if sub_vmess_type == "sing-box" and has_singbox then
result.type = 'sing-box'
elseif default_vmess_type == "xray" and has_xray then
elseif sub_vmess_type == "xray" and has_xray then
result.type = "Xray"
else
log(2, i18n.translatef("Skipping the %s node is due to incompatibility with the %s core program or incorrect node usage type settings.", "VMess", "VMess"))
return nil
end
result.alter_id = info.aid
result.address = info.add
result.port = info.port
result.protocol = 'vmess'
@@ -649,7 +648,7 @@ local function processData(szType, content, add_mode, group, sub_cfg)
result.tls_CertSha = info.pcs
result.tls_CertByName = info.vcn
local insecure = info.allowinsecure or info.allowInsecure or info.insecure
result.tls_allowInsecure = (insecure == "1" or insecure == "0") and insecure or (default_allowinsecure and "1" or "0")
result.tls_allowInsecure = (insecure == "1" or insecure == "0") and insecure or (sub_allowinsecure and "1" or "0")
else
result.tls = "0"
end
@@ -665,7 +664,7 @@ local function processData(szType, content, add_mode, group, sub_cfg)
return nil
end
elseif szType == "ss" then
result = set_ss_implementation(default_ss_type, result)
result = set_ss_implementation(sub_ss_type, result)
if not result then return nil end
--SS-URI = "ss://" userinfo "@" hostname ":" port [ "/" ] [ "?" plugin ] [ "#" tag ]
@@ -928,7 +927,7 @@ local function processData(szType, content, add_mode, group, sub_cfg)
end
end
local insecure = params.allowinsecure or params.allowInsecure or params.insecure
result.tls_allowInsecure = (insecure == "1" or insecure == "0") and insecure or (default_allowinsecure and "1" or "0")
result.tls_allowInsecure = (insecure == "1" or insecure == "0") and insecure or (sub_allowinsecure and "1" or "0")
result.uot = params.udp
elseif (params.type ~= "tcp" and params.type ~= "raw") and (params.headerType and params.headerType ~= "none") then
result.error_msg = i18n.translatef("Please replace Xray or Sing-Box to support more transmission methods in Shadowsocks.")
@@ -937,7 +936,7 @@ local function processData(szType, content, add_mode, group, sub_cfg)
if params["shadow-tls"] then
if result.type ~= "sing-box" and result.type ~= "SS-Rust" then
result.error_msg = default_ss_type .. " " .. i18n.translatef("unsupport %s plugin.", "shadow-tls")
result.error_msg = sub_ss_type .. " " .. i18n.translatef("unsupport %s plugin.", "shadow-tls")
else
-- Parsing SS Shadow-TLS plugin parameters
local function parseShadowTLSParams(b64str, out)
@@ -979,10 +978,10 @@ local function processData(szType, content, add_mode, group, sub_cfg)
end
end
elseif szType == "trojan" then
if default_trojan_type == "sing-box" and has_singbox then
if sub_trojan_type == "sing-box" and has_singbox then
result.type = 'sing-box'
result.protocol = 'trojan'
elseif default_trojan_type == "xray" and has_xray then
elseif sub_trojan_type == "xray" and has_xray then
result.type = 'Xray'
result.protocol = 'trojan'
else
@@ -1032,7 +1031,7 @@ local function processData(szType, content, add_mode, group, sub_cfg)
result.tls_CertSha = params.pcs
result.tls_CertByName = params.vcn
local insecure = params.allowinsecure or params.allowInsecure or params.insecure
result.tls_allowInsecure = (insecure == "1" or insecure == "0") and insecure or (default_allowinsecure and "1" or "0")
result.tls_allowInsecure = (insecure == "1" or insecure == "0") and insecure or (sub_allowinsecure and "1" or "0")
if not params.type then params.type = "tcp" end
params.type = string.lower(params.type)
@@ -1117,7 +1116,7 @@ local function processData(szType, content, add_mode, group, sub_cfg)
end
end
elseif szType == "ssd" then
result = set_ss_implementation(default_ss_type, result)
result = set_ss_implementation(sub_ss_type, result)
if not result then return nil end
result.address = content.server
result.port = content.port
@@ -1128,9 +1127,9 @@ local function processData(szType, content, add_mode, group, sub_cfg)
result.group = content.airport
result.remarks = content.remarks
elseif szType == "vless" then
if default_vless_type == "sing-box" and has_singbox then
if sub_vless_type == "sing-box" and has_singbox then
result.type = 'sing-box'
elseif default_vless_type == "xray" and has_xray then
elseif sub_vless_type == "xray" and has_xray then
result.type = "Xray"
else
log(2, i18n.translatef("Skipping the %s node is due to incompatibility with the %s core program or incorrect node usage type settings.", "VLESS", "VLESS"))
@@ -1283,7 +1282,7 @@ local function processData(szType, content, add_mode, group, sub_cfg)
result.reality_mldsa65Verify = params.pqv or nil
end
local insecure = params.allowinsecure or params.allowInsecure or params.insecure
result.tls_allowInsecure = (insecure == "1" or insecure == "0") and insecure or (default_allowinsecure and "1" or "0")
result.tls_allowInsecure = (insecure == "1" or insecure == "0") and insecure or (sub_allowinsecure and "1" or "0")
end
result.port = port
@@ -1340,7 +1339,7 @@ local function processData(szType, content, add_mode, group, sub_cfg)
result.hysteria_auth_password = params.auth
result.tls_serverName = params.peer or params.sni or ""
local insecure = params.allowinsecure or params.allowInsecure or params.insecure
result.tls_allowInsecure = (insecure == "1" or insecure == "0") and insecure or (default_allowinsecure and "1" or "0")
result.tls_allowInsecure = (insecure == "1" or insecure == "0") and insecure or (sub_allowinsecure and "1" or "0")
result.alpn = params.alpn
result.hysteria_up_mbps = params.upmbps
result.hysteria_down_mbps = params.downmbps
@@ -1386,12 +1385,12 @@ local function processData(szType, content, add_mode, group, sub_cfg)
result.tls_CertSha = params.pcs
result.tls_CertByName = params.vcn
local insecure = params.allowinsecure or params.insecure
result.tls_allowInsecure = (insecure == "1" or insecure == "0") and insecure or (default_allowinsecure and "1" or "0")
result.tls_allowInsecure = (insecure == "1" or insecure == "0") and insecure or (sub_allowinsecure and "1" or "0")
result.hysteria2_tls_pinSHA256 = params.pinSHA256
result.hysteria2_hop = params.mport
if (default_hysteria2_type == "sing-box" and has_singbox) or (default_hysteria2_type == "xray" and has_xray) then
local is_singbox = default_hysteria2_type == "sing-box" and has_singbox
if (sub_hysteria2_type == "sing-box" and has_singbox) or (sub_hysteria2_type == "xray" and has_xray) then
local is_singbox = sub_hysteria2_type == "sing-box" and has_singbox
result.type = is_singbox and 'sing-box' or 'Xray'
result.protocol = "hysteria2"
if params["obfs-password"] or params["obfs_password"] then
@@ -1466,7 +1465,7 @@ local function processData(szType, content, add_mode, group, sub_cfg)
result.tuic_congestion_control = params.congestion_control or "cubic"
result.tuic_udp_relay_mode = params.udp_relay_mode or "native"
local insecure = params.allowinsecure or params.insecure or params.allow_insecure
result.tls_allowInsecure = (insecure == "1" or insecure == "0") and insecure or (default_allowinsecure and "1" or "0")
result.tls_allowInsecure = (insecure == "1" or insecure == "0") and insecure or (sub_allowinsecure and "1" or "0")
elseif szType == "anytls" then
if has_singbox then
result.type = 'sing-box'
@@ -1530,7 +1529,7 @@ local function processData(szType, content, add_mode, group, sub_cfg)
end
result.port = port
local insecure = params.allowinsecure or params.insecure
result.tls_allowInsecure = (insecure == "1" or insecure == "0") and insecure or (default_allowinsecure and "1" or "0")
result.tls_allowInsecure = (insecure == "1" or insecure == "0") and insecure or (sub_allowinsecure and "1" or "0")
end
elseif szType == 'naive+https' or szType == 'naive+quic' then
if has_singbox then