update 2024-11-17 16:15:44

This commit is contained in:
actions-user 2024-11-17 16:15:44 +08:00
parent 3b2cd3f796
commit 104988b034
5 changed files with 83 additions and 69 deletions

View File

@ -334,10 +334,10 @@ o:depends({ [option_name("protocol")] = "shadowsocks" })
o = s:option(Flag, option_name("reality"), translate("REALITY"), translate("Only recommend to use with VLESS-TCP-XTLS-Vision."))
o.default = 0
o:depends({ [option_name("tls")] = true, [option_name("transport")] = "tcp" })
o:depends({ [option_name("tls")] = true, [option_name("transport")] = "raw" })
o:depends({ [option_name("tls")] = true, [option_name("transport")] = "h2" })
o:depends({ [option_name("tls")] = true, [option_name("transport")] = "grpc" })
o:depends({ [option_name("tls")] = true, [option_name("transport")] = "splithttp" })
o:depends({ [option_name("tls")] = true, [option_name("transport")] = "xhttp" })
o = s:option(ListValue, option_name("alpn"), translate("alpn"))
o.default = "default"
@ -393,7 +393,7 @@ o:depends({ [option_name("tls")] = true, [option_name("utls")] = true })
o:depends({ [option_name("tls")] = true, [option_name("reality")] = true })
o = s:option(ListValue, option_name("transport"), translate("Transport"))
o:value("tcp", "TCP")
o:value("raw", "RAW")
o:value("mkcp", "mKCP")
o:value("ws", "WebSocket")
o:value("h2", "HTTP/2")
@ -401,7 +401,7 @@ o:value("ds", "DomainSocket")
o:value("quic", "QUIC")
o:value("grpc", "gRPC")
o:value("httpupgrade", "HttpUpgrade")
o:value("splithttp", "SplitHTTP")
o:value("xhttp", "XHTTP")
o:depends({ [option_name("protocol")] = "vmess" })
o:depends({ [option_name("protocol")] = "vless" })
o:depends({ [option_name("protocol")] = "socks" })
@ -433,13 +433,13 @@ o = s:option(Value, option_name("wireguard_keepAlive"), translate("Keep Alive"))
o.default = "0"
o:depends({ [option_name("protocol")] = "wireguard" })
-- [[ TCP部分 ]]--
-- [[ RAW部分 ]]--
-- TCP伪装
o = s:option(ListValue, option_name("tcp_guise"), translate("Camouflage Type"))
o:value("none", "none")
o:value("http", "http")
o:depends({ [option_name("transport")] = "tcp" })
o:depends({ [option_name("transport")] = "raw" })
-- HTTP域名
o = s:option(DynamicList, option_name("tcp_guise_http_host"), translate("HTTP Host"))
@ -567,17 +567,17 @@ o = s:option(Value, option_name("httpupgrade_path"), translate("HttpUpgrade Path
o.placeholder = "/"
o:depends({ [option_name("transport")] = "httpupgrade" })
-- [[ XHTTP(SplitHTTP)部分 ]]--
o = s:option(Value, option_name("splithttp_host"), translate("SplitHTTP Host"))
o:depends({ [option_name("transport")] = "splithttp" })
-- [[ XHTTP部分 ]]--
o = s:option(Value, option_name("xhttp_host"), translate("XHTTP Host"))
o:depends({ [option_name("transport")] = "xhttp" })
o = s:option(Value, option_name("splithttp_path"), translate("SplitHTTP Path"))
o = s:option(Value, option_name("xhttp_path"), translate("XHTTP Path"))
o.placeholder = "/"
o:depends({ [option_name("transport")] = "splithttp" })
o:depends({ [option_name("transport")] = "xhttp" })
-- XHTTP XMUX
o = s:option(Flag, option_name("xhttp_xmux"), "XMUX", translate("Enable XHTTP XMUX. It's not recommended to enable Mux.Cool at the same time."))
o:depends({ [option_name("transport")] = "splithttp" })
o:depends({ [option_name("transport")] = "xhttp" })
o = s:option(Value, option_name("maxConcurrency"), translate("XMUX Max Concurrency"))
o:depends({ [option_name("xhttp_xmux")] = true })
@ -593,7 +593,7 @@ o:depends({ [option_name("xhttp_xmux")] = true })
-- XHTTP 下行
o = s:option(Flag, option_name("xhttp_download"), string.format('<a style="color:red">%s</a>', translate("XHTTP download splitting")))
o:depends({ [option_name("transport")] = "splithttp" })
o:depends({ [option_name("transport")] = "xhttp" })
o = s:option(Value, option_name("xhttp_download_address"), string.format('<a style="color:red">%s</a>', translate("Address")))
o:depends({ [option_name("xhttp_download")] = true })

View File

@ -109,7 +109,7 @@ o = s:option(ListValue, option_name("flow"), translate("flow"))
o.default = ""
o:value("", translate("Disable"))
o:value("xtls-rprx-vision")
o:depends({ [option_name("protocol")] = "vless", [option_name("tls")] = true, [option_name("transport")] = "tcp" })
o:depends({ [option_name("protocol")] = "vless", [option_name("tls")] = true, [option_name("transport")] = "RAW" })
o = s:option(Flag, option_name("tls"), translate("TLS"))
o.default = 0
@ -198,7 +198,7 @@ o.validate = function(self, value, t)
end
o = s:option(ListValue, option_name("transport"), translate("Transport"))
o:value("tcp", "TCP")
o:value("raw", "RAW")
o:value("mkcp", "mKCP")
o:value("ws", "WebSocket")
o:value("h2", "HTTP/2")
@ -206,7 +206,7 @@ o:value("ds", "DomainSocket")
o:value("quic", "QUIC")
o:value("grpc", "gRPC")
o:value("httpupgrade", "HttpUpgrade")
o:value("splithttp", "SplitHTTP")
o:value("xhttp", "XHTTP")
o:depends({ [option_name("protocol")] = "vmess" })
o:depends({ [option_name("protocol")] = "vless" })
o:depends({ [option_name("protocol")] = "socks" })
@ -230,12 +230,20 @@ o.placeholder = "/"
o:depends({ [option_name("transport")] = "httpupgrade" })
-- [[ SplitHTTP部分 ]]--
o = s:option(Value, option_name("splithttp_host"), translate("SplitHTTP Host"))
o:depends({ [option_name("transport")] = "splithttp" })
o = s:option(Value, option_name("xhttp_host"), translate("XHTTP Host"))
o:depends({ [option_name("transport")] = "xhttp" })
o = s:option(Value, option_name("splithttp_path"), translate("SplitHTTP Path"))
o = s:option(Value, option_name("xhttp_path"), translate("XHTTP Path"))
o.placeholder = "/"
o:depends({ [option_name("transport")] = "splithttp" })
o:depends({ [option_name("transport")] = "xhttp" })
o = s:option(Value, option_name("xhttp_maxuploadsize"), translate("maxUploadSize"))
o.default = "1000000"
o:depends({ [option_name("transport")] = "xhttp" })
o = s:option(Value, option_name("xhttp_maxconcurrentuploads"), translate("maxConcurrentUploads"))
o.default = "10"
o:depends({ [option_name("transport")] = "xhttp" })
-- [[ HTTP/2部分 ]]--
@ -251,7 +259,7 @@ o:depends({ [option_name("transport")] = "h2" })
o = s:option(ListValue, option_name("tcp_guise"), translate("Camouflage Type"))
o:value("none", "none")
o:value("http", "http")
o:depends({ [option_name("transport")] = "tcp" })
o:depends({ [option_name("transport")] = "raw" })
-- HTTP域名
o = s:option(DynamicList, option_name("tcp_guise_http_host"), translate("HTTP Host"))
@ -325,8 +333,8 @@ o.default = "0"
-- [[ Fallback部分 ]]--
o = s:option(Flag, option_name("fallback"), translate("Fallback"))
o:depends({ [option_name("protocol")] = "vless", [option_name("transport")] = "tcp" })
o:depends({ [option_name("protocol")] = "trojan", [option_name("transport")] = "tcp" })
o:depends({ [option_name("protocol")] = "vless", [option_name("transport")] = "raw" })
o:depends({ [option_name("protocol")] = "trojan", [option_name("transport")] = "raw" })
--[[
o = s:option(Value, option_name("fallback_alpn"), "Fallback alpn")

View File

@ -113,7 +113,7 @@ function gen_outbound(flag, node, tag, proxy_table)
end
end
if node.type == "Xray" and node.transport == "splithttp" then
if node.type == "Xray" and node.transport == "xhttp" then
if node.xhttp_download_tls and node.xhttp_download_tls == "1" then
node.xhttp_download_stream_security = "tls"
if node.xhttp_download_reality and node.xhttp_download_reality == "1" then
@ -171,7 +171,7 @@ function gen_outbound(flag, node, tag, proxy_table)
spiderX = node.reality_spiderX or "/",
fingerprint = (node.type == "Xray" and node.fingerprint and node.fingerprint ~= "") and node.fingerprint or "chrome"
} or nil,
tcpSettings = (node.transport == "tcp" and node.protocol ~= "socks") and {
rawSettings = ((node.transport == "raw" or node.transport == "tcp") and node.protocol ~= "socks") and {
header = {
type = node.tcp_guise or "none",
request = (node.tcp_guise == "http") and {
@ -225,9 +225,9 @@ function gen_outbound(flag, node, tag, proxy_table)
path = node.httpupgrade_path or "/",
host = node.httpupgrade_host
} or nil,
splithttpSettings = (node.transport == "splithttp") and {
path = node.splithttp_path or "/",
host = node.splithttp_host,
xhttpSettings = (node.transport == "xhttp" or node.transport == "splithttp") and {
path = node.xhttp_path or node.splithttp_path or "/",
host = node.xhttp_host or node.splithttp_host,
downloadSettings = (node.xhttp_download == "1") and {
address = node.xhttp_download_address,
port = tonumber(node.xhttp_download_port),
@ -319,14 +319,26 @@ function gen_outbound(flag, node, tag, proxy_table)
end
end
local alpn_download = {}
if node.xhttp_download_alpn and node.xhttp_download_alpn ~= "default" then
string.gsub(node.xhttp_download_alpn, '[^' .. "," .. ']+', function(w)
table.insert(alpn_download, w)
end)
end
if alpn_download and #alpn_download > 0 then
if result.streamSettings.xhttpSettings.downloadSettings.tlsSettings then
result.streamSettings.xhttpSettings.downloadSettings.tlsSettings.alpn = alpn_download
end
end
local xmux = {}
if (node.xhttp_xmux == "1") then
xmux.maxConcurrency = node.maxConcurrency and (string.find(node.maxConcurrency, "-") and node.maxConcurrency or tonumber(node.maxConcurrency)) or 0
xmux.maxConnections = node.maxConnections and (string.find(node.maxConnections, "-") and node.maxConnections or tonumber(node.maxConnections)) or 0
xmux.cMaxReuseTimes = node.cMaxReuseTimes and (string.find(node.cMaxReuseTimes, "-") and node.cMaxReuseTimes or tonumber(node.cMaxReuseTimes)) or 0
xmux.cMaxLifetimeMs = node.cMaxLifetimeMs and (string.find(node.cMaxLifetimeMs, "-") and node.cMaxLifetimeMs or tonumber(node.cMaxLifetimeMs)) or 0
if result.streamSettings.splithttpSettings then
result.streamSettings.splithttpSettings.xmux = xmux
if result.streamSettings.xhttpSettings then
result.streamSettings.xhttpSettings.xmux = xmux
end
end
@ -336,8 +348,8 @@ function gen_outbound(flag, node, tag, proxy_table)
xmux_download.maxConnections = node.download_maxConnections and (string.find(node.download_maxConnections, "-") and node.download_maxConnections or tonumber(node.download_maxConnections)) or 0
xmux_download.cMaxReuseTimes = node.download_cMaxReuseTimes and (string.find(node.download_cMaxReuseTimes, "-") and node.download_cMaxReuseTimes or tonumber(node.download_cMaxReuseTimes)) or 0
xmux_download.cMaxLifetimeMs = node.download_cMaxLifetimeMs and (string.find(node.download_cMaxLifetimeMs, "-") and node.download_cMaxLifetimeMs or tonumber(node.download_cMaxLifetimeMs)) or 0
if result.streamSettings.splithttpSettings.downloadSettings.xhttpSettings then
result.streamSettings.splithttpSettings.downloadSettings.xhttpSettings.xmux = xmux_download
if result.streamSettings.xhttpSettings.downloadSettings.xhttpSettings then
result.streamSettings.xhttpSettings.downloadSettings.xhttpSettings.xmux = xmux_download
end
end
@ -509,7 +521,7 @@ function gen_config_server(node)
}
}
} or nil,
tcpSettings = (node.transport == "tcp") and {
rawSettings = (node.transport == "raw" or node.transport == "tcp") and {
header = {
type = node.tcp_guise,
request = (node.tcp_guise == "http") and {
@ -553,9 +565,11 @@ function gen_config_server(node)
path = node.httpupgrade_path or "/",
host = node.httpupgrade_host
} or nil,
splithttpSettings = (node.transport == "splithttp") and {
path = node.splithttp_path or "/",
host = node.splithttp_host
xhttpSettings = (node.transport == "xhttp") and {
path = node.xhttp_path or "/",
host = node.xhttp_host,
maxUploadSize = node.xhttp_maxuploadsize,
maxConcurrentUploads = node.xhttp_maxconcurrentuploads
} or nil,
sockopt = {
acceptProxyProtocol = (node.acceptProxyProtocol and node.acceptProxyProtocol == "1") and true or false

View File

@ -213,7 +213,7 @@ local api = require "luci.passwall.api"
v_transport = "http";
params += opt.query("host", dom_prefix + "h2_host");
params += opt.query("path", dom_prefix + "h2_path");
} else if (v_transport === "tcp") {
} else if (v_transport === "raw" || v_transport === "tcp") {
params += opt.query("headerType", dom_prefix + "tcp_guise");
params += opt.query("host", dom_prefix + "tcp_guise_http_host");
params += opt.query("path", dom_prefix + "tcp_guise_http_path");
@ -303,7 +303,7 @@ local api = require "luci.passwall.api"
} else if (v_transport === "h2") {
info.host = opt.get(dom_prefix + "h2_host").value;
info.path = opt.get(dom_prefix + "h2_path").value;
} else if (v_transport === "tcp") {
} else if (v_transport === "raw" || v_transport === "tcp") {
info.type = opt.get(dom_prefix + "tcp_guise").value;
if (info.type === "http") {
info.host = opt.get(dom_prefix + "tcp_guise_http_host").value;
@ -352,7 +352,7 @@ local api = require "luci.passwall.api"
v_transport = "http";
params += opt.query("host", dom_prefix + "h2_host");
params += opt.query("path", dom_prefix + "h2_path");
} else if (v_transport === "tcp") {
} else if (v_transport === "raw" || v_transport === "tcp") {
params += opt.query("headerType", dom_prefix + "tcp_guise");
params += opt.query("host", dom_prefix + "tcp_guise_http_host");
params += opt.query("path", dom_prefix + "tcp_guise_http_path");
@ -367,12 +367,7 @@ local api = require "luci.passwall.api"
params += opt.query("path", dom_prefix + "grpc_serviceName");
params += opt.query("serviceName", dom_prefix + "grpc_serviceName");
params += opt.query("mode", dom_prefix + "grpc_mode");
} else if (v_transport === "splithttp") {
v_transport = "splithttp";
params += opt.query("host", dom_prefix + "splithttp_host");
params += opt.query("path", dom_prefix + "splithttp_path");
} else if (v_transport === "xhttp") {
v_transport = "xhttp";
params += opt.query("host", dom_prefix + "xhttp_host");
params += opt.query("path", dom_prefix + "xhttp_path");
} else if (v_transport === "httpupgrade") {
@ -434,7 +429,7 @@ local api = require "luci.passwall.api"
v_transport = "http";
params += opt.query("host", dom_prefix + "h2_host");
params += opt.query("path", dom_prefix + "h2_path");
} else if (v_transport === "tcp") {
} else if (v_transport === "raw" || v_transport === "tcp") {
params += opt.query("headerType", dom_prefix + "tcp_guise");
params += opt.query("host", dom_prefix + "tcp_guise_http_host");
params += opt.query("path", dom_prefix + "tcp_guise_http_path");
@ -818,7 +813,7 @@ local api = require "luci.passwall.api"
if (queryParam.type === "h2" || queryParam.type === "http")
queryParam.type = "h2"
opt.set(dom_prefix + 'transport', queryParam.type);
if (queryParam.type === "tcp") {
if (queryParam.type === "raw" || queryParam.type === "tcp") {
opt.set(dom_prefix + 'tcp_guise', queryParam.headerType || "none");
if (queryParam.headerType && queryParam.headerType != "none") {
opt.set(dom_prefix + 'tcp_guise_http_host', queryParam.host || "");
@ -928,7 +923,7 @@ local api = require "luci.passwall.api"
if (queryParam.type === "h2" || queryParam.type === "http")
queryParam.type = "h2"
opt.set(dom_prefix + 'transport', queryParam.type);
if (queryParam.type === "tcp") {
if (queryParam.type === "raw" || queryParam.type === "tcp") {
opt.set(dom_prefix + 'tcp_guise', queryParam.headerType || "none");
if (queryParam.headerType && queryParam.headerType != "none") {
opt.set(dom_prefix + 'tcp_guise_http_host', queryParam.host || "");
@ -1007,7 +1002,7 @@ local api = require "luci.passwall.api"
if (ssm.net === "kcp" || ssm.net === "mkcp")
ssm.net = "mkcp"
opt.set(dom_prefix + 'transport', ssm.net);
if (ssm.net === "tcp") {
if (ssm.net === "raw") {
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);
@ -1115,7 +1110,7 @@ local api = require "luci.passwall.api"
if (queryParam.type === "h2" || queryParam.type === "http")
queryParam.type = "h2"
opt.set(dom_prefix + 'transport', queryParam.type);
if (queryParam.type === "tcp") {
if (queryParam.type === "raw" || queryParam.type === "tcp") {
opt.set(dom_prefix + 'tcp_guise', queryParam.headerType || "none");
if (queryParam.headerType && queryParam.headerType != "none") {
opt.set(dom_prefix + 'tcp_guise_http_host', queryParam.host || "");
@ -1154,10 +1149,7 @@ local api = require "luci.passwall.api"
} else if (queryParam.type === "grpc") {
opt.set(dom_prefix + 'grpc_serviceName', (queryParam.serviceName || queryParam.path) || "");
opt.set(dom_prefix + 'grpc_mode', queryParam.mode);
} else if (queryParam.type === "splithttp") {
opt.set(dom_prefix + 'splithttp_host', queryParam.host || "");
opt.set(dom_prefix + 'splithttp_path', queryParam.path || "");
} else if (queryParam.type === "xhttp") {
} else if (queryParam.type === "xhttp" || queryParam.type === "splithttp") {
opt.set(dom_prefix + 'xhttp_host', queryParam.host || "");
opt.set(dom_prefix + 'xhttp_path', queryParam.path || "");
} else if (queryParam.type === "httpupgrade") {

View File

@ -470,7 +470,7 @@ local function processData(szType, content, add_mode, add_from)
result.h2_host = info.host
result.h2_path = info.path
end
if info.net == 'tcp' then
if info.net == 'raw' or info.net == 'tcp' then
if info.type and info.type ~= "http" then
info.type = "none"
end
@ -497,9 +497,9 @@ local function processData(szType, content, add_mode, add_from)
if info.net == 'grpc' then
result.grpc_serviceName = info.path
end
if info.net == 'splithttp' then
result.splithttp_host = info.host
result.splithttp_path = info.path
if info.net == 'xhttp' or info.net == 'splithttp' then
result.xhttp_host = info.host
result.xhttp_path = info.path
end
if info.net == 'httpupgrade' then
result.httpupgrade_host = info.host
@ -514,7 +514,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 == "splithttp") then
if result.type == "sing-box" and (result.transport == "mkcp" or result.transport == "xhttp" or result.transport == "raw" or result.transport == "splithttp") then
log("跳过节点:" .. result.remarks .."因Sing-Box不支持" .. szType .. "协议的" .. result.transport .. "传输方式需更换Xray。")
return nil
end
@ -675,7 +675,7 @@ local function processData(szType, content, add_mode, add_from)
result.h2_path = params.path
end
end
if params.type == 'tcp' then
if params.type == 'raw' or params.type == 'tcp' then
result.tcp_guise = params.headerType or "none"
result.tcp_guise_http_host = params.host
result.tcp_guise_http_path = params.path
@ -818,7 +818,7 @@ local function processData(szType, content, add_mode, add_from)
result.h2_path = params.path
end
end
if params.type == 'tcp' then
if params.type == 'raw' or params.type == 'tcp' then
result.tcp_guise = params.headerType or "none"
result.tcp_guise_http_host = params.host
result.tcp_guise_http_path = params.path
@ -844,9 +844,9 @@ local function processData(szType, content, add_mode, add_from)
if params.serviceName then result.grpc_serviceName = params.serviceName end
result.grpc_mode = params.mode
end
if params.type == 'splithttp' then
result.splithttp_host = params.host
result.splithttp_path = params.path
if info.net == 'xhttp' or info.net == 'splithttp' then
result.xhttp_host = params.host
result.xhttp_path = params.path
end
if params.type == 'httpupgrade' then
result.httpupgrade_host = params.host
@ -857,7 +857,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 == "splithttp") then
if result.type == "sing-box" and (result.transport == "mkcp" or result.transport == "xhttp" or result.transport == "raw" or result.transport == "splithttp") then
log("跳过节点:" .. result.remarks .."因Sing-Box不支持" .. szType .. "协议的" .. result.transport .. "传输方式需更换Xray。")
return nil
end
@ -955,7 +955,7 @@ local function processData(szType, content, add_mode, add_from)
result.h2_path = params.path
end
end
if params.type == 'tcp' then
if params.type == 'raw' or params.type == 'tcp' then
result.tcp_guise = params.headerType or "none"
result.tcp_guise_http_host = params.host
result.tcp_guise_http_path = params.path
@ -981,9 +981,9 @@ local function processData(szType, content, add_mode, add_from)
if params.serviceName then result.grpc_serviceName = params.serviceName end
result.grpc_mode = params.mode
end
if params.type == 'splithttp' then
result.splithttp_host = params.host
result.splithttp_path = params.path
if info.net == 'xhttp' or info.net == 'splithttp' then
result.xhttp_host = params.host
result.xhttp_path = params.path
end
if params.type == 'httpupgrade' then
result.httpupgrade_host = params.host
@ -1011,7 +1011,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 == "splithttp") then
if result.type == "sing-box" and (result.transport == "mkcp" or result.transport == "xhttp" or result.transport == "raw" or result.transport == "splithttp") then
log("跳过节点:" .. result.remarks .."因Sing-Box不支持" .. szType .. "协议的" .. result.transport .. "传输方式需更换Xray。")
return nil
end