luci-app-passwall: sync upstream

last commit: 8127c2593f
This commit is contained in:
gitea-action 2024-11-18 22:00:20 +08:00
parent 133a45e48e
commit 5d0f7dd0ee
2 changed files with 56 additions and 22 deletions

View File

@ -812,6 +812,11 @@ local api = require "luci.passwall.api"
queryParam.type = "mkcp"
if (queryParam.type === "h2" || queryParam.type === "http")
queryParam.type = "h2"
if (dom_prefix == "singbox_" && queryParam.type === "raw") {
queryParam.type = "tcp";
} else if (dom_prefix == "xray_" && queryParam.type === "tcp") {
queryParam.type = "raw";
}
opt.set(dom_prefix + 'transport', queryParam.type);
if (queryParam.type === "raw" || queryParam.type === "tcp") {
opt.set(dom_prefix + 'tcp_guise', queryParam.headerType || "none");
@ -851,7 +856,7 @@ local api = require "luci.passwall.api"
opt.set(dom_prefix + 'mkcp_guise', queryParam.headerType || "none");
} else if (queryParam.type === "grpc") {
opt.set(dom_prefix + 'grpc_serviceName', (queryParam.serviceName || queryParam.path) || "");
opt.set(dom_prefix + 'grpc_mode', queryParam.mode);
opt.set(dom_prefix + 'grpc_mode', queryParam.mode || "gun");
}
}
} else {
@ -922,6 +927,11 @@ local api = require "luci.passwall.api"
queryParam.type = "mkcp"
if (queryParam.type === "h2" || queryParam.type === "http")
queryParam.type = "h2"
if (dom_prefix == "singbox_" && queryParam.type === "raw") {
queryParam.type = "tcp";
} else if (dom_prefix == "xray_" && queryParam.type === "tcp") {
queryParam.type = "raw";
}
opt.set(dom_prefix + 'transport', queryParam.type);
if (queryParam.type === "raw" || queryParam.type === "tcp") {
opt.set(dom_prefix + 'tcp_guise', queryParam.headerType || "none");
@ -961,7 +971,7 @@ local api = require "luci.passwall.api"
opt.set(dom_prefix + 'mkcp_guise', queryParam.headerType || "none");
} else if (queryParam.type === "grpc") {
opt.set(dom_prefix + 'grpc_serviceName', (queryParam.serviceName || queryParam.path) || "");
opt.set(dom_prefix + 'grpc_mode', queryParam.mode);
opt.set(dom_prefix + 'grpc_mode', queryParam.mode || "gun");
}
if (m.hash) {
@ -1001,8 +1011,13 @@ local api = require "luci.passwall.api"
ssm.net = ssm.net.toLowerCase();
if (ssm.net === "kcp" || ssm.net === "mkcp")
ssm.net = "mkcp"
if (dom_prefix == "singbox_" && ssm.net === "raw") {
ssm.net = "tcp";
} else if (dom_prefix == "xray_" && ssm.net === "tcp") {
ssm.net = "raw";
}
opt.set(dom_prefix + 'transport', ssm.net);
if (ssm.net === "raw") {
if (ssm.net === "raw" || ssm.net === "tcp") {
opt.set(dom_prefix + 'tcp_guise', (ssm.host && ssm.path) ? "http" : "none");
if (ssm.host && ssm.path) {
opt.set(dom_prefix + 'tcp_guise_http_host', ssm.host);
@ -1109,6 +1124,11 @@ local api = require "luci.passwall.api"
queryParam.type = "mkcp"
if (queryParam.type === "h2" || queryParam.type === "http")
queryParam.type = "h2"
if (dom_prefix == "singbox_" && queryParam.type === "raw") {
queryParam.type = "tcp";
} else if (dom_prefix == "xray_" && queryParam.type === "tcp") {
queryParam.type = "raw";
}
opt.set(dom_prefix + 'transport', queryParam.type);
if (queryParam.type === "raw" || queryParam.type === "tcp") {
opt.set(dom_prefix + 'tcp_guise', queryParam.headerType || "none");
@ -1148,7 +1168,7 @@ local api = require "luci.passwall.api"
opt.set(dom_prefix + 'mkcp_guise', queryParam.headerType || "none");
} else if (queryParam.type === "grpc") {
opt.set(dom_prefix + 'grpc_serviceName', (queryParam.serviceName || queryParam.path) || "");
opt.set(dom_prefix + 'grpc_mode', queryParam.mode);
opt.set(dom_prefix + 'grpc_mode', queryParam.mode || "gun");
} else if (queryParam.type === "xhttp" || queryParam.type === "splithttp") {
opt.set(dom_prefix + 'xhttp_host', queryParam.host || "");
opt.set(dom_prefix + 'xhttp_path', queryParam.path || "");

View File

@ -442,10 +442,13 @@ local function processData(szType, content, add_mode, add_from)
-- result.mux = 1
-- result.mux_concurrency = 8
if not info.net then
info.net = "tcp"
end
if not info.net then info.net = "tcp" end
info.net = string.lower(info.net)
if result.type == "sing-box" and info.net == "raw" then
info.net = "tcp"
elseif result.type == "Xray" and info.net == "tcp" then
info.net = "raw"
end
result.transport = info.net
if info.net == 'ws' then
result.ws_host = info.host
@ -514,7 +517,7 @@ local function processData(szType, content, add_mode, add_from)
result.tls = "0"
end
if result.type == "sing-box" and (result.transport == "mkcp" or result.transport == "xhttp" or result.transport == "raw" or result.transport == "splithttp") then
if result.type == "sing-box" and (result.transport == "mkcp" or result.transport == "xhttp" or result.transport == "splithttp") then
log("跳过节点:" .. result.remarks .."因Sing-Box不支持" .. szType .. "协议的" .. result.transport .. "传输方式需更换Xray。")
return nil
end
@ -602,7 +605,7 @@ local function processData(szType, content, add_mode, add_from)
if ss_type_default == "xray" and has_xray then
result.type = 'Xray'
result.protocol = 'shadowsocks'
result.transport = 'tcp'
result.transport = 'raw'
end
if ss_type_default == "sing-box" and has_singbox then
result.type = 'sing-box'
@ -643,6 +646,11 @@ local function processData(szType, content, add_mode, add_from)
if params.type then
params.type = string.lower(params.type)
if result.type == "sing-box" and params.type == "raw" then
params.type = "tcp"
elseif result.type == "Xray" and params.type == "tcp" then
params.type = "raw"
end
result.transport = params.type
if result.type ~= "SS-Rust" and result.type ~= "SS" then
if params.type == 'ws' then
@ -699,7 +707,7 @@ local function processData(szType, content, add_mode, add_from)
if params.type == 'grpc' then
if params.path then result.grpc_serviceName = params.path end
if params.serviceName then result.grpc_serviceName = params.serviceName end
result.grpc_mode = params.mode
result.grpc_mode = params.mode or "gun"
end
result.tls = "0"
if params.security == "tls" or params.security == "reality" then
@ -783,10 +791,13 @@ local function processData(szType, content, add_mode, add_from)
result.tls_allowInsecure = allowInsecure_default and "1" or "0"
end
if not params.type then
params.type = "tcp"
end
if not params.type then params.type = "tcp" end
params.type = string.lower(params.type)
if result.type == "sing-box" and params.type == "raw" then
params.type = "tcp"
elseif result.type == "Xray" and params.type == "tcp" then
params.type = "raw"
end
result.transport = params.type
if params.type == 'ws' then
result.ws_host = params.host
@ -842,9 +853,9 @@ local function processData(szType, content, add_mode, add_from)
if params.type == 'grpc' then
if params.path then result.grpc_serviceName = params.path end
if params.serviceName then result.grpc_serviceName = params.serviceName end
result.grpc_mode = params.mode
result.grpc_mode = params.mode or "gun"
end
if info.net == 'xhttp' or info.net == 'splithttp' then
if params.type == 'xhttp' or params.type == 'splithttp' then
result.xhttp_host = params.host
result.xhttp_path = params.path
end
@ -857,7 +868,7 @@ local function processData(szType, content, add_mode, add_from)
result.flow = params.flow or nil
if result.type == "sing-box" and (result.transport == "mkcp" or result.transport == "xhttp" or result.transport == "raw" or result.transport == "splithttp") then
if result.type == "sing-box" and (result.transport == "mkcp" or result.transport == "xhttp" or result.transport == "splithttp") then
log("跳过节点:" .. result.remarks .."因Sing-Box不支持" .. szType .. "协议的" .. result.transport .. "传输方式需更换Xray。")
return nil
end
@ -920,10 +931,13 @@ local function processData(szType, content, add_mode, add_from)
result.address = host_port
end
if not params.type then
params.type = "tcp"
end
if not params.type then params.type = "tcp" end
params.type = string.lower(params.type)
if result.type == "sing-box" and params.type == "raw" then
params.type = "tcp"
elseif result.type == "Xray" and params.type == "tcp" then
params.type = "raw"
end
result.transport = params.type
if params.type == 'ws' then
result.ws_host = params.host
@ -979,9 +993,9 @@ local function processData(szType, content, add_mode, add_from)
if params.type == 'grpc' then
if params.path then result.grpc_serviceName = params.path end
if params.serviceName then result.grpc_serviceName = params.serviceName end
result.grpc_mode = params.mode
result.grpc_mode = params.mode or "gun"
end
if info.net == 'xhttp' or info.net == 'splithttp' then
if params.type == 'xhttp' or params.type == 'splithttp' then
result.xhttp_host = params.host
result.xhttp_path = params.path
end
@ -1011,7 +1025,7 @@ local function processData(szType, content, add_mode, add_from)
result.port = port
result.tls_allowInsecure = allowInsecure_default and "1" or "0"
if result.type == "sing-box" and (result.transport == "mkcp" or result.transport == "xhttp" or result.transport == "raw" or result.transport == "splithttp") then
if result.type == "sing-box" and (result.transport == "mkcp" or result.transport == "xhttp" or result.transport == "splithttp") then
log("跳过节点:" .. result.remarks .."因Sing-Box不支持" .. szType .. "协议的" .. result.transport .. "传输方式需更换Xray。")
return nil
end