luci-app-passwall2: sync upstream

last commit: 731102c8c8
This commit is contained in:
gitea-action 2024-11-19 23:31:15 +08:00
parent 10aae8e861
commit 8ca42bc063
3 changed files with 58 additions and 23 deletions

View File

@ -264,7 +264,8 @@ function gen_outbound(flag, node, tag, proxy_table)
level = 0, level = 0,
security = (node.protocol == "vmess") and node.security or nil, security = (node.protocol == "vmess") and node.security or nil,
encryption = node.encryption or "none", encryption = node.encryption or "none",
flow = (node.protocol == "vless" and node.tls == "1" and node.transport == "raw" and node.flow and node.flow ~= "") and node.flow or nil flow = (node.protocol == "vless" and node.tls == "1" and (node.transport == "raw" or node.transport == "tcp") and node.flow and node.flow ~= "") and node.flow or nil
} }
} }
} }

View File

@ -794,6 +794,11 @@ local api = require "luci.passwall2.api"
queryParam.type = "mkcp" queryParam.type = "mkcp"
if (queryParam.type === "h2" || queryParam.type === "http") if (queryParam.type === "h2" || queryParam.type === "http")
queryParam.type = "h2" 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); opt.set(dom_prefix + 'transport', queryParam.type);
if (queryParam.type === "raw" || queryParam.type === "tcp") { if (queryParam.type === "raw" || queryParam.type === "tcp") {
opt.set(dom_prefix + 'tcp_guise', queryParam.headerType || "none"); opt.set(dom_prefix + 'tcp_guise', queryParam.headerType || "none");
@ -833,7 +838,7 @@ local api = require "luci.passwall2.api"
opt.set(dom_prefix + 'mkcp_guise', queryParam.headerType || "none"); opt.set(dom_prefix + 'mkcp_guise', queryParam.headerType || "none");
} else if (queryParam.type === "grpc") { } else if (queryParam.type === "grpc") {
opt.set(dom_prefix + 'grpc_serviceName', (queryParam.serviceName || queryParam.path) || ""); 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 { } else {
@ -903,6 +908,11 @@ local api = require "luci.passwall2.api"
queryParam.type = "mkcp" queryParam.type = "mkcp"
if (queryParam.type === "h2" || queryParam.type === "http") if (queryParam.type === "h2" || queryParam.type === "http")
queryParam.type = "h2" 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); opt.set(dom_prefix + 'transport', queryParam.type);
if (queryParam.type === "raw" || queryParam.type === "tcp") { if (queryParam.type === "raw" || queryParam.type === "tcp") {
opt.set(dom_prefix + 'tcp_guise', queryParam.headerType || "none"); opt.set(dom_prefix + 'tcp_guise', queryParam.headerType || "none");
@ -942,7 +952,7 @@ local api = require "luci.passwall2.api"
opt.set(dom_prefix + 'mkcp_guise', queryParam.headerType || "none"); opt.set(dom_prefix + 'mkcp_guise', queryParam.headerType || "none");
} else if (queryParam.type === "grpc") { } else if (queryParam.type === "grpc") {
opt.set(dom_prefix + 'grpc_serviceName', (queryParam.serviceName || queryParam.path) || ""); 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");
} }
opt.set(dom_prefix + 'mux', queryParam.mux === '1'); opt.set(dom_prefix + 'mux', queryParam.mux === '1');
@ -983,8 +993,13 @@ local api = require "luci.passwall2.api"
ssm.net = ssm.net.toLowerCase(); ssm.net = ssm.net.toLowerCase();
if (ssm.net === "kcp" || ssm.net === "mkcp") if (ssm.net === "kcp" || ssm.net === "mkcp")
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); 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"); opt.set(dom_prefix + 'tcp_guise', (ssm.host && ssm.path) ? "http" : "none");
if (ssm.host && ssm.path) { if (ssm.host && ssm.path) {
opt.set(dom_prefix + 'tcp_guise_http_host', ssm.host); opt.set(dom_prefix + 'tcp_guise_http_host', ssm.host);
@ -1091,6 +1106,11 @@ local api = require "luci.passwall2.api"
queryParam.type = "mkcp" queryParam.type = "mkcp"
if (queryParam.type === "h2" || queryParam.type === "http") if (queryParam.type === "h2" || queryParam.type === "http")
queryParam.type = "h2" 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); opt.set(dom_prefix + 'transport', queryParam.type);
if (queryParam.type === "raw" || queryParam.type === "tcp") { if (queryParam.type === "raw" || queryParam.type === "tcp") {
opt.set(dom_prefix + 'tcp_guise', queryParam.headerType || "none"); opt.set(dom_prefix + 'tcp_guise', queryParam.headerType || "none");
@ -1130,7 +1150,7 @@ local api = require "luci.passwall2.api"
opt.set(dom_prefix + 'mkcp_guise', queryParam.headerType || "none"); opt.set(dom_prefix + 'mkcp_guise', queryParam.headerType || "none");
} else if (queryParam.type === "grpc") { } else if (queryParam.type === "grpc") {
opt.set(dom_prefix + 'grpc_serviceName', (queryParam.serviceName || queryParam.path) || ""); 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") { } else if (queryParam.type === "xhttp" || queryParam.type === "splithttp") {
opt.set(dom_prefix + 'xhttp_host', queryParam.host || ""); opt.set(dom_prefix + 'xhttp_host', queryParam.host || "");
opt.set(dom_prefix + 'xhttp_path', queryParam.path || ""); opt.set(dom_prefix + 'xhttp_path', queryParam.path || "");

View File

@ -428,10 +428,13 @@ local function processData(szType, content, add_mode, add_from)
-- result.mux = 1 -- result.mux = 1
-- result.mux_concurrency = 8 -- result.mux_concurrency = 8
if not info.net then if not info.net then info.net = "tcp" end
info.net = "tcp"
end
info.net = string.lower(info.net) 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 result.transport = info.net
if info.net == 'ws' then if info.net == 'ws' then
result.ws_host = info.host result.ws_host = info.host
@ -495,7 +498,7 @@ local function processData(szType, content, add_mode, add_from)
result.tls = "0" result.tls = "0"
end 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。") log("跳过节点:" .. result.remarks .."因Sing-Box不支持" .. szType .. "协议的" .. result.transport .. "传输方式需更换Xray。")
return nil return nil
end end
@ -582,7 +585,7 @@ local function processData(szType, content, add_mode, add_from)
if ss_type_default == "xray" and has_xray then if ss_type_default == "xray" and has_xray then
result.type = 'Xray' result.type = 'Xray'
result.protocol = 'shadowsocks' result.protocol = 'shadowsocks'
result.transport = 'tcp' result.transport = 'raw'
end end
if ss_type_default == "sing-box" and has_singbox then if ss_type_default == "sing-box" and has_singbox then
result.type = 'sing-box' result.type = 'sing-box'
@ -623,6 +626,11 @@ local function processData(szType, content, add_mode, add_from)
if params.type then if params.type then
params.type = string.lower(params.type) 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 result.transport = params.type
if result.type ~= "SS-Rust" and result.type ~= "SS" then if result.type ~= "SS-Rust" and result.type ~= "SS" then
if params.type == 'ws' then if params.type == 'ws' then
@ -679,7 +687,7 @@ local function processData(szType, content, add_mode, add_from)
if params.type == 'grpc' then if params.type == 'grpc' then
if params.path then result.grpc_serviceName = params.path end if params.path then result.grpc_serviceName = params.path end
if params.serviceName then result.grpc_serviceName = params.serviceName end if params.serviceName then result.grpc_serviceName = params.serviceName end
result.grpc_mode = params.mode result.grpc_mode = params.mode or "gun"
end end
result.tls = "0" result.tls = "0"
if params.security == "tls" or params.security == "reality" then if params.security == "tls" or params.security == "reality" then
@ -767,10 +775,13 @@ local function processData(szType, content, add_mode, add_from)
result.tls_allowInsecure = allowInsecure_default and "1" or "0" result.tls_allowInsecure = allowInsecure_default and "1" or "0"
end end
if not params.type then if not params.type then params.type = "tcp" end
params.type = "tcp"
end
params.type = string.lower(params.type) 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 result.transport = params.type
if params.type == 'ws' then if params.type == 'ws' then
result.ws_host = params.host result.ws_host = params.host
@ -826,9 +837,9 @@ local function processData(szType, content, add_mode, add_from)
if params.type == 'grpc' then if params.type == 'grpc' then
if params.path then result.grpc_serviceName = params.path end if params.path then result.grpc_serviceName = params.path end
if params.serviceName then result.grpc_serviceName = params.serviceName end if params.serviceName then result.grpc_serviceName = params.serviceName end
result.grpc_mode = params.mode result.grpc_mode = params.mode or "gun"
end 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_host = params.host
result.xhttp_path = params.path result.xhttp_path = params.path
end end
@ -837,7 +848,7 @@ local function processData(szType, content, add_mode, add_from)
result.flow = params.flow or nil 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。") log("跳过节点:" .. result.remarks .."因Sing-Box不支持" .. szType .. "协议的" .. result.transport .. "传输方式需更换Xray。")
return nil return nil
end end
@ -899,10 +910,13 @@ local function processData(szType, content, add_mode, add_from)
result.address = host_port result.address = host_port
end end
if not params.type then if not params.type then params.type = "tcp" end
params.type = "tcp"
end
params.type = string.lower(params.type) 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 result.transport = params.type
if params.type == 'ws' then if params.type == 'ws' then
result.ws_host = params.host result.ws_host = params.host
@ -957,9 +971,9 @@ local function processData(szType, content, add_mode, add_from)
if params.type == 'grpc' then if params.type == 'grpc' then
if params.path then result.grpc_serviceName = params.path end if params.path then result.grpc_serviceName = params.path end
if params.serviceName then result.grpc_serviceName = params.serviceName end if params.serviceName then result.grpc_serviceName = params.serviceName end
result.grpc_mode = params.mode result.grpc_mode = params.mode or "gun"
end 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_host = params.host
result.xhttp_path = params.path result.xhttp_path = params.path
end end
@ -985,7 +999,7 @@ local function processData(szType, content, add_mode, add_from)
result.port = port result.port = port
result.tls_allowInsecure = allowInsecure_default and "1" or "0" 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。") log("跳过节点:" .. result.remarks .."因Sing-Box不支持" .. szType .. "协议的" .. result.transport .. "传输方式需更换Xray。")
return nil return nil
end end