🔥 Sync 2026-11-07 02:27:09
Merge-upstream / merge (push) Waiting to run

This commit is contained in:
github-actions[bot] committed 2026-11-07 02:27:09 +08:00
1 parent 208c8bf5a2
commit 7eb1d53ed5
12 files changed
+817 -1009

No files matched your search

@@ -547,6 +547,19 @@ local function set_ss_implementation(ss_type, result)
return result
end
-- 拆分 URI 地址和端口,支持省略端口的 IPv6 地址,并去除路径。
local function parse_host_port(host_port, default_port)
local authority = (host_port or ""):gsub("/.*$", "")
local address, port = authority:match("^%[([^%]]+)%]:(.*)$")
if not address then
address = authority:match("^%[([^%]]+)%]$")
end
if not address then
address, port = authority:match("^([^:]+):(.*)$")
end
return address or authority, (port and port ~= "") and port or default_port
end
-- 处理数据
local function processData(szType, content, add_mode, group, sub_cfg)
--log(2, content, add_mode, group)
@@ -642,17 +655,7 @@ local function processData(szType, content, add_mode, group, sub_cfg)
info.security = (#id_info > 1 and id_info[1] ~= "") and id_info[1] or "auto"
info.id = id_info[#id_info]
local addr, port = sp[2], "443"
if api.is_ipv6addrport(addr) then
local a, p = addr:match("^%[(.+)%]:(%d+)$")
if a then addr, port = a, p end
addr = api.get_ipv6_only(addr)
else
local host_port = split(addr, ":")
addr = host_port[1]
if #host_port > 1 then port = host_port[#host_port] end
end
info.add, info.port = addr, port
info.add, info.port = parse_host_port(sp[2], "443")
local params = {}
for _, v in pairs(split(Info[2], '&')) do
@@ -844,19 +847,8 @@ local function processData(szType, content, add_mode, group, sub_cfg)
local hostInfo = split(base64Decode(UrlDecode(info)), "@")
if hostInfo and #hostInfo > 0 then
local host_port = hostInfo[#hostInfo]
-- [2001:4860:4860::8888]:443
-- 8.8.8.8:443
if host_port:find(":") then
local sp = split(host_port, ":")
result.port = sp[#sp]
if api.is_ipv6addrport(host_port) then
result.address = api.get_ipv6_only(host_port)
else
result.address = sp[1]
end
else
result.address = host_port
end
-- SIP002 要求显式端口,不设置缺省值。
result.address, result.port = parse_host_port(host_port)
local userinfo = nil
if #hostInfo > 2 then
@@ -1120,19 +1112,7 @@ local function processData(szType, content, add_mode, group, sub_cfg)
params[v:sub(1, s - 1)] = UrlDecode(v:sub(s + 1))
end
end
-- [2001:4860:4860::8888]:443
-- 8.8.8.8:443
if host_port:find(":") then
local sp = split(host_port, ":")
port = sp[#sp]
if api.is_ipv6addrport(host_port) then
result.address = api.get_ipv6_only(host_port)
else
result.address = sp[1]
end
else
result.address = host_port
end
result.address, port = parse_host_port(host_port, port)
result.port = port
params.security = params.security or "tls"
@@ -1269,19 +1249,7 @@ local function processData(szType, content, add_mode, group, sub_cfg)
params[v:sub(1, s - 1)] = UrlDecode(v:sub(s + 1))
end
end
-- [2001:4860:4860::8888]:443
-- 8.8.8.8:443
if host_port:find(":") then
local sp = split(host_port, ":")
port = sp[#sp]
if api.is_ipv6addrport(host_port) then
result.address = api.get_ipv6_only(host_port)
else
result.address = sp[1]
end
else
result.address = host_port
end
result.address, port = parse_host_port(host_port, port)
if not params.type then params.type = "tcp" end
params.type = string.lower(params.type)
@@ -1422,19 +1390,7 @@ local function processData(szType, content, add_mode, group, sub_cfg)
params[v:sub(1, s - 1)] = UrlDecode(v:sub(s + 1))
end
end
-- [2001:4860:4860::8888]:443
-- 8.8.8.8:443
if host_port:find(":") then
local sp = split(host_port, ":")
result.port = sp[#sp]
if api.is_ipv6addrport(host_port) then
result.address = api.get_ipv6_only(host_port)
else
result.address = sp[1]
end
else
result.address = host_port
end
result.address, result.port = parse_host_port(host_port, "443")
result.hysteria_obfs = params.obfsParam
result.hysteria_auth_type = "string"
result.hysteria_auth_password = params.auth
@@ -1471,19 +1427,7 @@ local function processData(szType, content, add_mode, group, sub_cfg)
params[v:sub(1, s - 1):lower()] = UrlDecode(v:sub(s + 1))
end
end
-- [2001:4860:4860::8888]:443
-- 8.8.8.8:443
if host_port:find(":") then
local sp = split(host_port, ":")
result.port = sp[#sp]
if api.is_ipv6addrport(host_port) then
result.address = api.get_ipv6_only(host_port)
else
result.address = sp[1]
end
else
result.address = host_port
end
result.address, result.port = parse_host_port(host_port, "443")
result.tls_serverName = params.sni
result.tls_pinSHA256 = params.pcs or params.pinsha256
result.tls_CertByName = params.vcn
@@ -1557,17 +1501,7 @@ local function processData(szType, content, add_mode, group, sub_cfg)
params[v:sub(1, s - 1):lower()] = UrlDecode(v:sub(s + 1))
end
end
if host_port:find(":") then
local sp = split(host_port, ":")
result.port = sp[#sp]
if api.is_ipv6addrport(host_port) then
result.address = api.get_ipv6_only(host_port)
else
result.address = sp[1]
end
else
result.address = host_port
end
result.address, result.port = parse_host_port(host_port, "443")
result.tls_serverName = params.sni
result.tls_disable_sni = params.disable_sni
result.tls_CertByName = params.vcn
@@ -1607,19 +1541,7 @@ local function processData(szType, content, add_mode, group, sub_cfg)
params[v:sub(1, s - 1):lower()] = UrlDecode(v:sub(s + 1))
end
end
-- [2001:4860:4860::8888]:443
-- 8.8.8.8:443
if host_port:find(":") then
local sp = split(host_port, ":")
port = sp[#sp]
if api.is_ipv6addrport(host_port) then
result.address = api.get_ipv6_only(host_port)
else
result.address = sp[1]
end
else
result.address = host_port
end
result.address, port = parse_host_port(host_port, port)
result.tls = "0"
if not params.security or params.security == "" then
params.security = "tls"
@@ -1687,17 +1609,7 @@ local function processData(szType, content, add_mode, group, sub_cfg)
params[v:sub(1, s - 1)] = UrlDecode(v:sub(s + 1))
end
end
if host_port:find(":") then
local sp = split(host_port, ":")
result.port = sp[#sp]
if api.is_ipv6addrport(host_port) then
result.address = api.get_ipv6_only(host_port)
else
result.address = sp[1]
end
else
result.address = host_port
end
result.address, result.port = parse_host_port(host_port, "443")
result.tls_serverName = params.sni
result.uot = params.uot
result.naive_insecure_concurrency = params["insecure-concurrency"] or "0"
@@ -1741,20 +1653,7 @@ local function processData(szType, content, add_mode, group, sub_cfg)
params[UrlDecode(v:sub(1, s - 1)):lower()] = UrlDecode(v:sub(s + 1))
end
end
-- [2001:4860:4860::8888]:443
-- 8.8.8.8:443
result.port = "443"
if host_port:find(":") then
local sp = split(host_port, ":")
result.port = sp[#sp]
if api.is_ipv6addrport(host_port) then
result.address = api.get_ipv6_only(host_port)
else
result.address = sp[1]
end
else
result.address = host_port
end
result.address, result.port = parse_host_port(host_port, "443")
result.snell_psk = params.psk or result.snell_psk
result.password = params.userkey
result.snell_version = params.version or "4"