update 2026-05-31 15:41:19

This commit is contained in:
action committed 2026-05-31 15:41:19 +08:00
1 parent a8a3ebd3f2
commit a132233834
4 files changed
+692 -559

No files matched your search

@@ -53,6 +53,32 @@ if server.type == "ss-rust" then
server.type = "ss"
end
local function parse_realm_uri(uri)
if type(uri) ~= "string" then return nil end
-- realm://token@server/realm_id?query
local token, server_url, realm_id, query = trim(uri):match("^realm://([^@]+)@([^/]+)/([^?]*)%??(.*)$")
if not token or not server_url or not realm_id then return nil end
realm_id = realm_id:gsub("/+$", "")
local realm = {
token = token,
server_url = server_url,
realm_id = realm_id
}
-- 解析 query 中的 stun=
if query and query ~= "" then
local stun_servers = {}
for key, value in query:gmatch("([^&=?]+)=([^&]+)") do
if key == "stun" and value ~= "" then
stun_servers[#stun_servers + 1] = value
end
end
if #stun_servers > 0 then
realm.stun_servers = stun_servers
end
end
return realm
end
-- base64 解码
local function base64Decode(text)
local raw = text
@@ -569,7 +595,7 @@ Xray.outbounds = {
local finalmask = {}
local PT = server.v2ray_protocol
local TP = server.transport
if server.transport == "kcp" then
if TP == "kcp" then
local map = {none = "none", srtp = "header-srtp", utp = "header-utp", ["wechat-video"] = "header-wechat",
dtls = "header-dtls", wireguard = "header-wireguard", dns = "header-dns"}
local udp = {}
@@ -587,14 +613,35 @@ Xray.outbounds = {
udp[#udp+1] = c
finalmask.udp = udp
elseif PT == "hysteria2" then
local udp = {}
if (server.flag_obfs == "1" and (server.obfs_type and server.obfs_type ~= "")) then
finalmask.udp = {{
local o = {
type = server.obfs_type,
settings = server.salamander and {
password = server.salamander
} or nil
}}
}
udp[#udp+1] = o
end
if server.hysteria2_realms then
local realm = parse_realm_uri(server.hysteria2_realm_url)
local url, stun
if realm then
if realm.token and realm.server_url and realm.realm_id then
url = "realm://" .. realm.token .. "@" .. realm.server_url .. "/" .. realm.realm_id
end
stun = realm.stun_servers or server.hysteria2_realm_stun
end
local r = {
type = "realm",
settings = {
url = url,
stunServers = stun
}
}
udp[#udp+1] = r
end
finalmask.udp = udp
local up = tonumber(server.uplink_capacity) or 0
local down = tonumber(server.downlink_capacity) or 0
finalmask.quicParams = {