mirror of
https://github.com/roacn/openwrt-packages.git
synced 2025-01-07 03:16:45 +08:00
🍕 Sync 2024-02-27 09:17
This commit is contained in:
parent
424fda6d48
commit
5f48afeb91
@ -225,6 +225,10 @@ local api = require "luci.passwall.api"
|
||||
if (v_transport === "ws") {
|
||||
info.host = opt.get(dom_prefix + "ws_host").value;
|
||||
info.path = opt.get(dom_prefix + "ws_path").value;
|
||||
if (v_type == "sing-box" && opt.get(dom_prefix + "ws_enableEarlyData").checked) {
|
||||
var ws_maxEarlyData = opt.get(dom_prefix + "ws_maxEarlyData").value;
|
||||
info.path = info.path + "?ed=" + ws_maxEarlyData;
|
||||
}
|
||||
} else if (v_transport === "h2") {
|
||||
info.host = opt.get(dom_prefix + "h2_host").value;
|
||||
info.path = opt.get(dom_prefix + "h2_path").value;
|
||||
@ -269,6 +273,10 @@ local api = require "luci.passwall.api"
|
||||
if (v_transport === "ws") {
|
||||
params += opt.query("host", dom_prefix + "ws_host");
|
||||
params += opt.query("path", dom_prefix + "ws_path");
|
||||
if (v_type == "sing-box" && opt.get(dom_prefix + "ws_enableEarlyData").checked) {
|
||||
var ws_maxEarlyData = opt.get(dom_prefix + "ws_maxEarlyData").value;
|
||||
params += "?ed=" + ws_maxEarlyData;
|
||||
}
|
||||
} else if (v_transport === "h2") {
|
||||
v_transport = "http";
|
||||
params += opt.query("host", dom_prefix + "h2_host");
|
||||
@ -704,6 +712,24 @@ local api = require "luci.passwall.api"
|
||||
} else if (ssm.net === "ws") {
|
||||
opt.set(dom_prefix + 'ws_host', ssm.host);
|
||||
opt.set(dom_prefix + 'ws_path', ssm.path);
|
||||
if (dom_prefix == "singbox_" && ssm.path && ssm.path.length > 1) {
|
||||
var ws_path_params = {};
|
||||
var ws_path_dat = ssm.path.split('?');
|
||||
var ws_path = ws_path_dat[0];
|
||||
var ws_path_params = {};
|
||||
var ws_path_params_array = ws_path_dat[1].split('&');
|
||||
for (i = 0; i < ws_path_params_array.length; i++) {
|
||||
var kv = ws_path_params_array[i].split('=');
|
||||
ws_path_params[decodeURIComponent(kv[0]).toLowerCase()] = decodeURIComponent(kv[1] || '');
|
||||
}
|
||||
|
||||
if (ws_path_params.ed) {
|
||||
opt.set(dom_prefix + 'ws_path', ws_path);
|
||||
opt.set(dom_prefix + 'ws_enableEarlyData', true);
|
||||
opt.set(dom_prefix + 'ws_maxEarlyData', ws_path_params.ed);
|
||||
opt.set(dom_prefix + 'ws_earlyDataHeaderName', 'Sec-WebSocket-Protocol');
|
||||
}
|
||||
}
|
||||
} else if (ssm.net === "h2") {
|
||||
opt.set(dom_prefix + 'h2_host', ssm.host);
|
||||
opt.set(dom_prefix + 'h2_path', ssm.path);
|
||||
@ -793,6 +819,24 @@ local api = require "luci.passwall.api"
|
||||
} else if (queryParam.type === "ws") {
|
||||
opt.set(dom_prefix + 'ws_host', queryParam.host || "");
|
||||
opt.set(dom_prefix + 'ws_path', queryParam.path || "");
|
||||
if (dom_prefix == "singbox_" && queryParam.path && queryParam.path.length > 1) {
|
||||
var ws_path_params = {};
|
||||
var ws_path_dat = queryParam.path.split('?');
|
||||
var ws_path = ws_path_dat[0];
|
||||
var ws_path_params = {};
|
||||
var ws_path_params_array = ws_path_dat[1].split('&');
|
||||
for (i = 0; i < ws_path_params_array.length; i++) {
|
||||
var kv = ws_path_params_array[i].split('=');
|
||||
ws_path_params[decodeURIComponent(kv[0]).toLowerCase()] = decodeURIComponent(kv[1] || '');
|
||||
}
|
||||
|
||||
if (ws_path_params.ed) {
|
||||
opt.set(dom_prefix + 'ws_path', ws_path);
|
||||
opt.set(dom_prefix + 'ws_enableEarlyData', true);
|
||||
opt.set(dom_prefix + 'ws_maxEarlyData', ws_path_params.ed);
|
||||
opt.set(dom_prefix + 'ws_earlyDataHeaderName', 'Sec-WebSocket-Protocol');
|
||||
}
|
||||
}
|
||||
} else if (queryParam.type === "h2" || queryParam.type === "http") {
|
||||
opt.set(dom_prefix + 'h2_host', queryParam.host || "");
|
||||
opt.set(dom_prefix + 'h2_path', queryParam.path || "");
|
||||
|
@ -406,6 +406,21 @@ local function processData(szType, content, add_mode, add_from)
|
||||
if info.net == 'ws' then
|
||||
result.ws_host = info.host
|
||||
result.ws_path = info.path
|
||||
if result.type == "sing-box" and info.path then
|
||||
local ws_path_dat = split(info.path, "?")
|
||||
local ws_path = ws_path_dat[1]
|
||||
local ws_path_params = {}
|
||||
for _, v in pairs(split(ws_path_dat[2], '&')) do
|
||||
local t = split(v, '=')
|
||||
ws_path_params[t[1]] = t[2]
|
||||
end
|
||||
if ws_path_params.ed and tonumber(ws_path_params.ed) then
|
||||
result.ws_path = ws_path
|
||||
result.ws_enableEarlyData = "1"
|
||||
result.ws_maxEarlyData = tonumber(ws_path_params.ed)
|
||||
result.ws_earlyDataHeaderName = "Sec-WebSocket-Protocol"
|
||||
end
|
||||
end
|
||||
end
|
||||
if info.net == 'h2' then
|
||||
result.h2_host = info.host
|
||||
@ -693,6 +708,21 @@ local function processData(szType, content, add_mode, add_from)
|
||||
if params.type == 'ws' then
|
||||
result.ws_host = params.host
|
||||
result.ws_path = params.path
|
||||
if result.type == "sing-box" and params.path then
|
||||
local ws_path_dat = split(params.path, "?")
|
||||
local ws_path = ws_path_dat[1]
|
||||
local ws_path_params = {}
|
||||
for _, v in pairs(split(ws_path_dat[2], '&')) do
|
||||
local t = split(v, '=')
|
||||
ws_path_params[t[1]] = t[2]
|
||||
end
|
||||
if ws_path_params.ed and tonumber(ws_path_params.ed) then
|
||||
result.ws_path = ws_path
|
||||
result.ws_enableEarlyData = "1"
|
||||
result.ws_maxEarlyData = tonumber(ws_path_params.ed)
|
||||
result.ws_earlyDataHeaderName = "Sec-WebSocket-Protocol"
|
||||
end
|
||||
end
|
||||
end
|
||||
if params.type == 'h2' or params.type == 'http' then
|
||||
params.type = "h2"
|
||||
|
@ -225,6 +225,10 @@ local api = require "luci.passwall2.api"
|
||||
if (v_transport === "ws") {
|
||||
info.host = opt.get(dom_prefix + "ws_host").value;
|
||||
info.path = opt.get(dom_prefix + "ws_path").value;
|
||||
if (v_type == "sing-box" && opt.get(dom_prefix + "ws_enableEarlyData").checked) {
|
||||
var ws_maxEarlyData = opt.get(dom_prefix + "ws_maxEarlyData").value;
|
||||
info.path = info.path + "?ed=" + ws_maxEarlyData;
|
||||
}
|
||||
} else if (v_transport === "h2") {
|
||||
info.host = opt.get(dom_prefix + "h2_host").value;
|
||||
info.path = opt.get(dom_prefix + "h2_path").value;
|
||||
@ -269,6 +273,10 @@ local api = require "luci.passwall2.api"
|
||||
if (v_transport === "ws") {
|
||||
params += opt.query("host", dom_prefix + "ws_host");
|
||||
params += opt.query("path", dom_prefix + "ws_path");
|
||||
if (v_type == "sing-box" && opt.get(dom_prefix + "ws_enableEarlyData").checked) {
|
||||
var ws_maxEarlyData = opt.get(dom_prefix + "ws_maxEarlyData").value;
|
||||
params += "?ed=" + ws_maxEarlyData;
|
||||
}
|
||||
} else if (v_transport === "h2") {
|
||||
v_transport = "http";
|
||||
params += opt.query("host", dom_prefix + "h2_host");
|
||||
@ -720,6 +728,24 @@ local api = require "luci.passwall2.api"
|
||||
} else if (ssm.net === "ws") {
|
||||
opt.set(dom_prefix + 'ws_host', ssm.host);
|
||||
opt.set(dom_prefix + 'ws_path', ssm.path);
|
||||
if (dom_prefix == "singbox_" && ssm.path && ssm.path.length > 1) {
|
||||
var ws_path_params = {};
|
||||
var ws_path_dat = ssm.path.split('?');
|
||||
var ws_path = ws_path_dat[0];
|
||||
var ws_path_params = {};
|
||||
var ws_path_params_array = ws_path_dat[1].split('&');
|
||||
for (i = 0; i < ws_path_params_array.length; i++) {
|
||||
var kv = ws_path_params_array[i].split('=');
|
||||
ws_path_params[decodeURIComponent(kv[0]).toLowerCase()] = decodeURIComponent(kv[1] || '');
|
||||
}
|
||||
|
||||
if (ws_path_params.ed) {
|
||||
opt.set(dom_prefix + 'ws_path', ws_path);
|
||||
opt.set(dom_prefix + 'ws_enableEarlyData', true);
|
||||
opt.set(dom_prefix + 'ws_maxEarlyData', ws_path_params.ed);
|
||||
opt.set(dom_prefix + 'ws_earlyDataHeaderName', 'Sec-WebSocket-Protocol');
|
||||
}
|
||||
}
|
||||
} else if (ssm.net === "h2") {
|
||||
opt.set(dom_prefix + 'h2_host', ssm.host);
|
||||
opt.set(dom_prefix + 'h2_path', ssm.path);
|
||||
@ -809,6 +835,24 @@ local api = require "luci.passwall2.api"
|
||||
} else if (queryParam.type === "ws") {
|
||||
opt.set(dom_prefix + 'ws_host', queryParam.host || "");
|
||||
opt.set(dom_prefix + 'ws_path', queryParam.path || "");
|
||||
if (dom_prefix == "singbox_" && queryParam.path && queryParam.path.length > 1) {
|
||||
var ws_path_params = {};
|
||||
var ws_path_dat = queryParam.path.split('?');
|
||||
var ws_path = ws_path_dat[0];
|
||||
var ws_path_params = {};
|
||||
var ws_path_params_array = ws_path_dat[1].split('&');
|
||||
for (i = 0; i < ws_path_params_array.length; i++) {
|
||||
var kv = ws_path_params_array[i].split('=');
|
||||
ws_path_params[decodeURIComponent(kv[0]).toLowerCase()] = decodeURIComponent(kv[1] || '');
|
||||
}
|
||||
|
||||
if (ws_path_params.ed) {
|
||||
opt.set(dom_prefix + 'ws_path', ws_path);
|
||||
opt.set(dom_prefix + 'ws_enableEarlyData', true);
|
||||
opt.set(dom_prefix + 'ws_maxEarlyData', ws_path_params.ed);
|
||||
opt.set(dom_prefix + 'ws_earlyDataHeaderName', 'Sec-WebSocket-Protocol');
|
||||
}
|
||||
}
|
||||
} else if (queryParam.type === "h2" || queryParam.type === "http") {
|
||||
opt.set(dom_prefix + 'h2_host', queryParam.host || "");
|
||||
opt.set(dom_prefix + 'h2_path', queryParam.path || "");
|
||||
|
@ -401,6 +401,21 @@ local function processData(szType, content, add_mode, add_from)
|
||||
if info.net == 'ws' then
|
||||
result.ws_host = info.host
|
||||
result.ws_path = info.path
|
||||
if result.type == "sing-box" and info.path then
|
||||
local ws_path_dat = split(info.path, "?")
|
||||
local ws_path = ws_path_dat[1]
|
||||
local ws_path_params = {}
|
||||
for _, v in pairs(split(ws_path_dat[2], '&')) do
|
||||
local t = split(v, '=')
|
||||
ws_path_params[t[1]] = t[2]
|
||||
end
|
||||
if ws_path_params.ed and tonumber(ws_path_params.ed) then
|
||||
result.ws_path = ws_path
|
||||
result.ws_enableEarlyData = "1"
|
||||
result.ws_maxEarlyData = tonumber(ws_path_params.ed)
|
||||
result.ws_earlyDataHeaderName = "Sec-WebSocket-Protocol"
|
||||
end
|
||||
end
|
||||
end
|
||||
if info.net == 'h2' then
|
||||
result.h2_host = info.host
|
||||
@ -672,6 +687,21 @@ local function processData(szType, content, add_mode, add_from)
|
||||
if params.type == 'ws' then
|
||||
result.ws_host = params.host
|
||||
result.ws_path = params.path
|
||||
if result.type == "sing-box" and params.path then
|
||||
local ws_path_dat = split(params.path, "?")
|
||||
local ws_path = ws_path_dat[1]
|
||||
local ws_path_params = {}
|
||||
for _, v in pairs(split(ws_path_dat[2], '&')) do
|
||||
local t = split(v, '=')
|
||||
ws_path_params[t[1]] = t[2]
|
||||
end
|
||||
if ws_path_params.ed and tonumber(ws_path_params.ed) then
|
||||
result.ws_path = ws_path
|
||||
result.ws_enableEarlyData = "1"
|
||||
result.ws_maxEarlyData = tonumber(ws_path_params.ed)
|
||||
result.ws_earlyDataHeaderName = "Sec-WebSocket-Protocol"
|
||||
end
|
||||
end
|
||||
end
|
||||
if params.type == 'h2' or params.type == 'http' then
|
||||
params.type = "h2"
|
||||
|
Loading…
Reference in New Issue
Block a user