mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-15 04:53:00 +08:00
🤞 Sync 2026-11-10 21:15:30
This commit is contained in:
1 parent
42de8331af
commit
4a38dae8ff
27 files changed
+1281
-235
No files matched your search
@@ -366,9 +366,26 @@ function gen_outbound(flag, node, tag, proxy_table)
|
||||
Host = node.ws_host,
|
||||
["User-Agent"] = node.user_agent
|
||||
} or nil,
|
||||
max_early_data = tonumber(node.ws_maxEarlyData) or nil,
|
||||
early_data_header_name = (node.ws_earlyDataHeaderName) and node.ws_earlyDataHeaderName or nil -- For compatibility with Xray-core, set it to Sec-WebSocket-Protocol. It needs to be consistent with the server.
|
||||
}
|
||||
local path, query = (node.ws_path or "/"):match("^(.-)%?(.*)$")
|
||||
local params, query_params = {}, {}
|
||||
for v in (query or ""):gmatch("[^&]+") do
|
||||
local t = api.split(api.UrlDecode(v), '=')
|
||||
params[t[1]] = t[2]
|
||||
if t[1] ~= "ed" and t[1] ~= "eh" then
|
||||
table.insert(query_params, v)
|
||||
end
|
||||
end
|
||||
local ed = tonumber(params.ed)
|
||||
if ed then
|
||||
-- Consume early-data options while preserving the remaining query.
|
||||
v2ray_transport.path = path
|
||||
if #query_params > 0 then
|
||||
v2ray_transport.path = path .. "?" .. table.concat(query_params, "&")
|
||||
end
|
||||
v2ray_transport.max_early_data = ed
|
||||
end
|
||||
v2ray_transport.early_data_header_name = params.eh or "Sec-WebSocket-Protocol"
|
||||
end
|
||||
|
||||
if node.transport == "httpupgrade" then
|
||||
@@ -822,7 +839,7 @@ function gen_config_server(node)
|
||||
type = "ws",
|
||||
path = node.ws_path or "/",
|
||||
headers = (node.ws_host ~= nil) and { Host = node.ws_host } or nil,
|
||||
early_data_header_name = (node.ws_earlyDataHeaderName) and node.ws_earlyDataHeaderName or nil -- For compatibility with Xray-core, set it to Sec-WebSocket-Protocol. It needs to be consistent with the server.
|
||||
early_data_header_name = (node.ws_earlyDataHeaderName) and node.ws_earlyDataHeaderName or "Sec-WebSocket-Protocol"
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
Reference in new issue
Block a user