update 2026-06-29 23:37:40

This commit is contained in:
action committed 2026-06-29 23:37:40 +08:00
1 parent c8ceebd509
commit f769dc4727
15 files changed
+1645 -1217

No files matched your search

@@ -54,12 +54,20 @@ if server.type == "ss-rust" then
end
local function parse_realm_uri(uri)
if type(uri) ~= "string" then return nil end
uri = trim(uri)
if uri == "" then return nil end
-- realm[+http]://token@server/realm_id?query
local scheme, token, server_url, realm_id, query = trim(uri):match("^(realm%+http|realm)://([^@]+)@([^/]+)/([^?]*)%??(.*)$")
if not scheme or not token or not server_url or not realm_id then return nil end
local scheme = (uri:match("^realm%+http://") and "realm+http") or (uri:match("^realm://") and "realm")
if not scheme then return nil end
uri = uri:gsub("^realm%+http://", ""):gsub("^realm://", "")
local token, server_url, realm_id, query = uri:match("^([^@]+)@([^/]+)/([^?]*)%??(.*)$")
if not token or not server_url or not realm_id then return nil end
realm_id = realm_id:gsub("/+$", "")
local address, port = server_url:match("^%[?([^%]]+)%]?:?(%d*)$")
local address, port = server_url:match("^%[([^%]]+)%]:(%d+)$") --ipv6:port
if not address then
address, port = server_url:match("^([^:]+):(%d+)$") --ipv4[domain]:port
end
address = address or server_url:match("^%[([^%]]+)%]$") or server_url
port = tonumber(port) or (scheme == "realm+http" and 80 or 443)
local realm = {
scheme = scheme,
@@ -71,9 +79,9 @@ local function parse_realm_uri(uri)
}
-- 解析 query 中的 stun=
local stun_servers
for value in (query or ""):gmatch("[?&]?[Ss][Tt][Uu][Nn]=([^&]+)") do
if not stun_servers then stun_servers = {} end
stun_servers[#stun_servers + 1] = value
for v in (query or ""):gmatch("[Ss][Tt][Uu][Nn]=([^&]+)") do
stun_servers = stun_servers or {}
stun_servers[#stun_servers + 1] = v
end
realm.stun_servers = stun_servers
return realm
@@ -649,10 +657,18 @@ Xray.outbounds = {
local o = {
type = "salamander",
settings = server.salamander and {
password = server.salamander,
packetSize = server.obfs_type == "gecko" and "512-1200" or nil
password = server.salamander
} or nil
}
if server.obfs_type == "gecko" then
local min = tonumber(server.obfs_MinPacketSize) or 512
local max = tonumber(server.obfs_MaxPacketSize) or 1200
if min <= 0 or min > max or max > 2048 then
min = 512
max = 1200
end
o.settings.packetSize = min .. "-" .. max
end
udp[#udp+1] = o
end
if server.hysteria2_realms then
@@ -959,6 +975,9 @@ local hysteria2 = {
up = tonumber(server.uplink_capacity) and tonumber(server.uplink_capacity) .. " mbps" or nil,
down = tonumber(server.downlink_capacity) and tonumber(server.downlink_capacity) .. " mbps" or nil
} or nil,
realm = (server.hysteria2_realms and server.hysteria2_realm_stun) and {
stunServers = server.hysteria2_realm_stun
} or nil,
socks5 = (proto:find("tcp") and tonumber(socks_port) and tonumber(socks_port) ~= 0) and {
listen = "0.0.0.0:" .. tonumber(socks_port),
disableUDP = false
@@ -1000,7 +1019,7 @@ local hysteria2 = {
} or nil,
obfs = (server.flag_obfs == "1") and {
type = server.obfs_type,
salamander = { password = server.salamander }
[server.obfs_type] = { password = server.salamander }
} or nil,
quic = (server.flag_quicparam == "1" ) and {
initStreamReceiveWindow = (server.initstreamreceivewindow and server.initstreamreceivewindow or nil),
@@ -1049,6 +1068,16 @@ local hysteria2 = {
fast_open = (server.fast_open == "1") and true or false,
lazy = (server.lazy_mode == "1") and true or false
}
if hysteria2.obfs and hysteria2.obfs.type == "gecko" then
local min = tonumber(server.obfs_MinPacketSize) or 512
local max = tonumber(server.obfs_MaxPacketSize) or 1200
if min <= 0 or min > max or max > 2048 then
min = 512
max = 1200
end
hysteria2.obfs.gecko.minPacketSize = min
hysteria2.obfs.gecko.maxPacketSize = max
end
local shadowtls = {
client = {
server_addr = server.server_port and format_host_port(server.server, server.server_port) or nil,