mirror of
https://github.com/kenzok8/small.git
synced 2025-01-07 03:26:39 +08:00
update 2024-12-24 04:13:38
This commit is contained in:
parent
9f216d1e94
commit
c8c694741e
@ -394,7 +394,6 @@ o = s:option(ListValue, _n("transport"), translate("Transport"))
|
||||
o:value("raw", "RAW (TCP)")
|
||||
o:value("mkcp", "mKCP")
|
||||
o:value("ws", "WebSocket")
|
||||
o:value("h2", "HTTP/2")
|
||||
o:value("ds", "DomainSocket")
|
||||
o:value("quic", "QUIC")
|
||||
o:value("grpc", "gRPC")
|
||||
@ -496,25 +495,6 @@ o = s:option(Value, _n("ws_heartbeatPeriod"), translate("HeartbeatPeriod(second)
|
||||
o.datatype = "integer"
|
||||
o:depends({ [_n("transport")] = "ws" })
|
||||
|
||||
-- [[ HTTP/2部分 ]]--
|
||||
o = s:option(Value, _n("h2_host"), translate("HTTP/2 Host"))
|
||||
o:depends({ [_n("transport")] = "h2" })
|
||||
|
||||
o = s:option(Value, _n("h2_path"), translate("HTTP/2 Path"))
|
||||
o.placeholder = "/"
|
||||
o:depends({ [_n("transport")] = "h2" })
|
||||
|
||||
o = s:option(Flag, _n("h2_health_check"), translate("Health check"))
|
||||
o:depends({ [_n("transport")] = "h2" })
|
||||
|
||||
o = s:option(Value, _n("h2_read_idle_timeout"), translate("Idle timeout"))
|
||||
o.default = "10"
|
||||
o:depends({ [_n("h2_health_check")] = true })
|
||||
|
||||
o = s:option(Value, _n("h2_health_check_timeout"), translate("Health check timeout"))
|
||||
o.default = "15"
|
||||
o:depends({ [_n("h2_health_check")] = true })
|
||||
|
||||
-- [[ DomainSocket部分 ]]--
|
||||
o = s:option(Value, _n("ds_path"), "Path", translate("A legal file path. This file must not exist before running."))
|
||||
o:depends({ [_n("transport")] = "ds" })
|
||||
|
@ -201,7 +201,6 @@ o = s:option(ListValue, _n("transport"), translate("Transport"))
|
||||
o:value("raw", "RAW")
|
||||
o:value("mkcp", "mKCP")
|
||||
o:value("ws", "WebSocket")
|
||||
o:value("h2", "HTTP/2")
|
||||
o:value("ds", "DomainSocket")
|
||||
o:value("quic", "QUIC")
|
||||
o:value("grpc", "gRPC")
|
||||
@ -245,14 +244,6 @@ o = s:option(Value, _n("xhttp_maxconcurrentuploads"), translate("maxConcurrentUp
|
||||
o.default = "10"
|
||||
o:depends({ [_n("transport")] = "xhttp" })
|
||||
|
||||
-- [[ HTTP/2部分 ]]--
|
||||
|
||||
o = s:option(Value, _n("h2_host"), translate("HTTP/2 Host"))
|
||||
o:depends({ [_n("transport")] = "h2" })
|
||||
|
||||
o = s:option(Value, _n("h2_path"), translate("HTTP/2 Path"))
|
||||
o:depends({ [_n("transport")] = "h2" })
|
||||
|
||||
-- [[ TCP部分 ]]--
|
||||
|
||||
-- TCP伪装
|
||||
|
@ -191,12 +191,6 @@ function gen_outbound(flag, node, tag, proxy_table)
|
||||
earlyDataHeaderName = (node.ws_earlyDataHeaderName) and node.ws_earlyDataHeaderName or nil,
|
||||
heartbeatPeriod = tonumber(node.ws_heartbeatPeriod) or nil
|
||||
} or nil,
|
||||
httpSettings = (node.transport == "h2") and {
|
||||
path = node.h2_path or "/",
|
||||
host = node.h2_host,
|
||||
read_idle_timeout = tonumber(node.h2_read_idle_timeout) or nil,
|
||||
health_check_timeout = tonumber(node.h2_health_check_timeout) or nil
|
||||
} or nil,
|
||||
dsSettings = (node.transport == "ds") and
|
||||
{path = node.ds_path} or nil,
|
||||
quicSettings = (node.transport == "quic") and {
|
||||
@ -488,9 +482,6 @@ function gen_config_server(node)
|
||||
host = node.ws_host or nil,
|
||||
path = node.ws_path
|
||||
} or nil,
|
||||
httpSettings = (node.transport == "h2") and {
|
||||
path = node.h2_path, host = node.h2_host
|
||||
} or nil,
|
||||
dsSettings = (node.transport == "ds") and {
|
||||
path = node.ds_path
|
||||
} or nil,
|
||||
|
@ -810,16 +810,22 @@ local api = require "luci.passwall.api"
|
||||
}
|
||||
|
||||
queryParam.type = queryParam.type.toLowerCase();
|
||||
if (queryParam.type === "kcp" || queryParam.type === "mkcp")
|
||||
queryParam.type = "mkcp"
|
||||
if (queryParam.type === "h2" || queryParam.type === "http")
|
||||
queryParam.type = "h2"
|
||||
if (queryParam.type === "kcp" || queryParam.type === "mkcp") {
|
||||
queryParam.type = "mkcp";
|
||||
}
|
||||
if (queryParam.type === "h2" || queryParam.type === "http") {
|
||||
queryParam.type = "http";
|
||||
}
|
||||
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 (dom_prefix == "xray_" && queryParam.type === "http") {
|
||||
opt.set(dom_prefix + 'transport', "xhttp");
|
||||
} else {
|
||||
opt.set(dom_prefix + 'transport', queryParam.type);
|
||||
}
|
||||
if (queryParam.type === "raw" || queryParam.type === "tcp") {
|
||||
opt.set(dom_prefix + 'tcp_guise', queryParam.headerType || "none");
|
||||
if (queryParam.headerType && queryParam.headerType != "none") {
|
||||
@ -848,8 +854,14 @@ local api = require "luci.passwall.api"
|
||||
}
|
||||
}
|
||||
} else if (queryParam.type === "h2" || queryParam.type === "http") {
|
||||
opt.set(dom_prefix + 'h2_host', queryParam.host || "");
|
||||
opt.set(dom_prefix + 'h2_path', queryParam.path || "");
|
||||
if (dom_prefix == "xray_") {
|
||||
opt.set(dom_prefix + 'xhttp_mode', "stream-one");
|
||||
opt.set(dom_prefix + 'xhttp_host', queryParam.host || "");
|
||||
opt.set(dom_prefix + 'xhttp_path', queryParam.path || "");
|
||||
} else {
|
||||
opt.set(dom_prefix + 'http_host', queryParam.host || "");
|
||||
opt.set(dom_prefix + 'http_path', queryParam.path || "");
|
||||
}
|
||||
} else if (queryParam.type === "quic") {
|
||||
opt.set(dom_prefix + 'quic_guise', queryParam.headerType || "none");
|
||||
opt.set(dom_prefix + 'quic_security', queryParam.quicSecurity);
|
||||
@ -925,16 +937,22 @@ local api = require "luci.passwall.api"
|
||||
opt.set(dom_prefix + 'password', decodeURIComponent(password));
|
||||
|
||||
queryParam.type = queryParam.type.toLowerCase();
|
||||
if (queryParam.type === "kcp" || queryParam.type === "mkcp")
|
||||
queryParam.type = "mkcp"
|
||||
if (queryParam.type === "h2" || queryParam.type === "http")
|
||||
queryParam.type = "h2"
|
||||
if (queryParam.type === "kcp" || queryParam.type === "mkcp") {
|
||||
queryParam.type = "mkcp";
|
||||
}
|
||||
if (queryParam.type === "h2" || queryParam.type === "http") {
|
||||
queryParam.type = "http";
|
||||
}
|
||||
if (dom_prefix == "singbox_" && queryParam.type === "raw") {
|
||||
queryParam.type = "tcp";
|
||||
queryParam.type = "tcp";
|
||||
} else if (dom_prefix == "xray_" && queryParam.type === "tcp") {
|
||||
queryParam.type = "raw";
|
||||
}
|
||||
opt.set(dom_prefix + 'transport', queryParam.type);
|
||||
if (dom_prefix == "xray_" && queryParam.type === "http") {
|
||||
opt.set(dom_prefix + 'transport', "xhttp");
|
||||
} else {
|
||||
opt.set(dom_prefix + 'transport', queryParam.type);
|
||||
}
|
||||
if (queryParam.type === "raw" || queryParam.type === "tcp") {
|
||||
opt.set(dom_prefix + 'tcp_guise', queryParam.headerType || "none");
|
||||
if (queryParam.headerType && queryParam.headerType != "none") {
|
||||
@ -963,8 +981,14 @@ local api = require "luci.passwall.api"
|
||||
}
|
||||
}
|
||||
} else if (queryParam.type === "h2" || queryParam.type === "http") {
|
||||
opt.set(dom_prefix + 'h2_host', queryParam.host || "");
|
||||
opt.set(dom_prefix + 'h2_path', queryParam.path || "");
|
||||
if (dom_prefix == "xray_") {
|
||||
opt.set(dom_prefix + 'xhttp_mode', "stream-one");
|
||||
opt.set(dom_prefix + 'xhttp_host', queryParam.host || "");
|
||||
opt.set(dom_prefix + 'xhttp_path', queryParam.path || "");
|
||||
} else {
|
||||
opt.set(dom_prefix + 'http_host', queryParam.host || "");
|
||||
opt.set(dom_prefix + 'http_path', queryParam.path || "");
|
||||
}
|
||||
} else if (queryParam.type === "quic") {
|
||||
opt.set(dom_prefix + 'quic_guise', queryParam.headerType || "none");
|
||||
opt.set(dom_prefix + 'quic_security', queryParam.quicSecurity);
|
||||
@ -1030,7 +1054,14 @@ local api = require "luci.passwall.api"
|
||||
} else if (dom_prefix == "xray_" && ssm.net === "tcp") {
|
||||
ssm.net = "raw";
|
||||
}
|
||||
opt.set(dom_prefix + 'transport', ssm.net);
|
||||
if (ssm.net === "h2" || ssm.net === "http") {
|
||||
ssm.net = "http";
|
||||
}
|
||||
if (dom_prefix == "xray_" && ssm.net === "http") {
|
||||
opt.set(dom_prefix + 'transport', "xhttp");
|
||||
} else {
|
||||
opt.set(dom_prefix + 'transport', ssm.net);
|
||||
}
|
||||
if (ssm.net === "raw" || ssm.net === "tcp") {
|
||||
opt.set(dom_prefix + 'tcp_guise', (ssm.host && ssm.path) ? "http" : "none");
|
||||
if (ssm.host && ssm.path) {
|
||||
@ -1058,9 +1089,15 @@ local api = require "luci.passwall.api"
|
||||
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);
|
||||
} else if (ssm.net === "http") {
|
||||
if (dom_prefix == "xray_") {
|
||||
opt.set(dom_prefix + 'xhttp_mode', "stream-one");
|
||||
opt.set(dom_prefix + 'xhttp_host', ssm.host || "");
|
||||
opt.set(dom_prefix + 'xhttp_path', ssm.path || "");
|
||||
} else {
|
||||
opt.set(dom_prefix + 'http_host', ssm.host || "");
|
||||
opt.set(dom_prefix + 'http_path', ssm.path || "");
|
||||
}
|
||||
} else if (ssm.net === "quic") {
|
||||
opt.set(dom_prefix + 'quic_security', ssm.securty);
|
||||
opt.set(dom_prefix + 'quic_key', ssm.key);
|
||||
@ -1134,16 +1171,22 @@ local api = require "luci.passwall.api"
|
||||
}
|
||||
|
||||
queryParam.type = queryParam.type.toLowerCase();
|
||||
if (queryParam.type === "kcp" || queryParam.type === "mkcp")
|
||||
queryParam.type = "mkcp"
|
||||
if (queryParam.type === "h2" || queryParam.type === "http")
|
||||
queryParam.type = "h2"
|
||||
if (queryParam.type === "kcp" || queryParam.type === "mkcp") {
|
||||
queryParam.type = "mkcp";
|
||||
}
|
||||
if (queryParam.type === "h2" || queryParam.type === "http") {
|
||||
queryParam.type = "http";
|
||||
}
|
||||
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 (dom_prefix == "xray_" && queryParam.type === "http") {
|
||||
opt.set(dom_prefix + 'transport', "xhttp");
|
||||
} else {
|
||||
opt.set(dom_prefix + 'transport', queryParam.type);
|
||||
}
|
||||
if (queryParam.type === "raw" || queryParam.type === "tcp") {
|
||||
opt.set(dom_prefix + 'tcp_guise', queryParam.headerType || "none");
|
||||
if (queryParam.headerType && queryParam.headerType != "none") {
|
||||
@ -1172,8 +1215,14 @@ local api = require "luci.passwall.api"
|
||||
}
|
||||
}
|
||||
} else if (queryParam.type === "h2" || queryParam.type === "http") {
|
||||
opt.set(dom_prefix + 'h2_host', queryParam.host || "");
|
||||
opt.set(dom_prefix + 'h2_path', queryParam.path || "");
|
||||
if (dom_prefix == "xray_") {
|
||||
opt.set(dom_prefix + 'xhttp_mode', "stream-one");
|
||||
opt.set(dom_prefix + 'xhttp_host', queryParam.host || "");
|
||||
opt.set(dom_prefix + 'xhttp_path', queryParam.path || "");
|
||||
} else {
|
||||
opt.set(dom_prefix + 'http_host', queryParam.host || "");
|
||||
opt.set(dom_prefix + 'http_path', queryParam.path || "");
|
||||
}
|
||||
} else if (queryParam.type === "quic") {
|
||||
opt.set(dom_prefix + 'quic_guise', queryParam.headerType || "none");
|
||||
opt.set(dom_prefix + 'quic_security', queryParam.quicSecurity);
|
||||
|
@ -466,7 +466,12 @@ local function processData(szType, content, add_mode, add_from)
|
||||
elseif result.type == "Xray" and info.net == "tcp" then
|
||||
info.net = "raw"
|
||||
end
|
||||
result.transport = info.net
|
||||
if info.net == 'h2' or info.net == 'http' then
|
||||
info.net = "http"
|
||||
result.transport = (result.type == "Xray") and "xhttp" or "http"
|
||||
else
|
||||
result.transport = info.net
|
||||
end
|
||||
if info.net == 'ws' then
|
||||
result.ws_host = info.host
|
||||
result.ws_path = info.path
|
||||
@ -486,9 +491,15 @@ local function processData(szType, content, add_mode, add_from)
|
||||
end
|
||||
end
|
||||
end
|
||||
if info.net == 'h2' then
|
||||
result.h2_host = info.host
|
||||
result.h2_path = info.path
|
||||
if info.net == "http" then
|
||||
if result.type == "Xray" then
|
||||
result.xhttp_mode = "stream-one"
|
||||
result.xhttp_host = info.host
|
||||
result.xhttp_path = info.path
|
||||
else
|
||||
result.http_host = info.host
|
||||
result.http_path = info.path
|
||||
end
|
||||
end
|
||||
if info.net == 'raw' or info.net == 'tcp' then
|
||||
if info.type and info.type ~= "http" then
|
||||
@ -668,7 +679,12 @@ local function processData(szType, content, add_mode, add_from)
|
||||
elseif result.type == "Xray" and params.type == "tcp" then
|
||||
params.type = "raw"
|
||||
end
|
||||
result.transport = params.type
|
||||
if params.type == "h2" or params.type == "http" then
|
||||
params.type = "http"
|
||||
result.transport = (result.type == "Xray") and "xhttp" or "http"
|
||||
else
|
||||
result.transport = params.type
|
||||
end
|
||||
if result.type ~= "SS-Rust" and result.type ~= "SS" then
|
||||
if params.type == 'ws' then
|
||||
result.ws_host = params.host
|
||||
@ -689,15 +705,16 @@ local function processData(szType, content, add_mode, add_from)
|
||||
end
|
||||
end
|
||||
end
|
||||
if params.type == 'h2' or params.type == 'http' then
|
||||
if params.type == "http" then
|
||||
if result.type == "sing-box" then
|
||||
result.transport = "http"
|
||||
result.http_host = params.host
|
||||
result.http_path = params.path
|
||||
elseif result.type == "xray" then
|
||||
result.transport = "h2"
|
||||
result.h2_host = params.host
|
||||
result.h2_path = params.path
|
||||
elseif result.type == "Xray" then
|
||||
result.transport = "xhttp"
|
||||
result.xhttp_mode = "stream-one"
|
||||
result.xhttp_host = params.host
|
||||
result.xhttp_path = params.path
|
||||
end
|
||||
end
|
||||
if params.type == 'raw' or params.type == 'tcp' then
|
||||
@ -815,7 +832,12 @@ local function processData(szType, content, add_mode, add_from)
|
||||
elseif result.type == "Xray" and params.type == "tcp" then
|
||||
params.type = "raw"
|
||||
end
|
||||
result.transport = params.type
|
||||
if params.type == "h2" or params.type == "http" then
|
||||
params.type = "http"
|
||||
result.transport = (result.type == "Xray") and "xhttp" or "http"
|
||||
else
|
||||
result.transport = params.type
|
||||
end
|
||||
if params.type == 'ws' then
|
||||
result.ws_host = params.host
|
||||
result.ws_path = params.path
|
||||
@ -835,15 +857,16 @@ local function processData(szType, content, add_mode, add_from)
|
||||
end
|
||||
end
|
||||
end
|
||||
if params.type == 'h2' or params.type == 'http' then
|
||||
if params.type == "http" then
|
||||
if result.type == "sing-box" then
|
||||
result.transport = "http"
|
||||
result.http_host = params.host
|
||||
result.http_path = params.path
|
||||
elseif result.type == "xray" then
|
||||
result.transport = "h2"
|
||||
result.h2_host = params.host
|
||||
result.h2_path = params.path
|
||||
elseif result.type == "Xray" then
|
||||
result.transport = "xhttp"
|
||||
result.xhttp_mode = "stream-one"
|
||||
result.xhttp_host = params.host
|
||||
result.xhttp_path = params.path
|
||||
end
|
||||
end
|
||||
if params.type == 'raw' or params.type == 'tcp' then
|
||||
@ -955,7 +978,12 @@ local function processData(szType, content, add_mode, add_from)
|
||||
elseif result.type == "Xray" and params.type == "tcp" then
|
||||
params.type = "raw"
|
||||
end
|
||||
result.transport = params.type
|
||||
if params.type == "h2" or params.type == "http" then
|
||||
params.type = "http"
|
||||
result.transport = (result.type == "Xray") and "xhttp" or "http"
|
||||
else
|
||||
result.transport = params.type
|
||||
end
|
||||
if params.type == 'ws' then
|
||||
result.ws_host = params.host
|
||||
result.ws_path = params.path
|
||||
@ -975,15 +1003,16 @@ local function processData(szType, content, add_mode, add_from)
|
||||
end
|
||||
end
|
||||
end
|
||||
if params.type == 'h2' or params.type == 'http' then
|
||||
if params.type == "http" then
|
||||
if result.type == "sing-box" then
|
||||
result.transport = "http"
|
||||
result.http_host = params.host
|
||||
result.http_path = params.path
|
||||
elseif result.type == "xray" then
|
||||
result.transport = "h2"
|
||||
result.h2_host = params.host
|
||||
result.h2_path = params.path
|
||||
elseif result.type == "Xray" then
|
||||
result.transport = "xhttp"
|
||||
result.xhttp_mode = "stream-one"
|
||||
result.xhttp_host = params.host
|
||||
result.xhttp_path = params.path
|
||||
end
|
||||
end
|
||||
if params.type == 'raw' or params.type == 'tcp' then
|
||||
|
Loading…
Reference in New Issue
Block a user