diff --git a/luci-app-passwall2/Makefile b/luci-app-passwall2/Makefile index b1e68741f..520f388eb 100644 --- a/luci-app-passwall2/Makefile +++ b/luci-app-passwall2/Makefile @@ -5,7 +5,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-passwall2 -PKG_VERSION:=24.12.22 +PKG_VERSION:=24.12.25 PKG_RELEASE:=1 PKG_CONFIG_DEPENDS:= \ diff --git a/luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/ray.lua b/luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/ray.lua index 974f8330b..b2e2b61a7 100644 --- a/luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/ray.lua +++ b/luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/ray.lua @@ -397,7 +397,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") @@ -499,25 +498,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" }) diff --git a/luci-app-passwall2/luasrc/model/cbi/passwall2/server/type/ray.lua b/luci-app-passwall2/luasrc/model/cbi/passwall2/server/type/ray.lua index c37990f48..ad3d2204a 100644 --- a/luci-app-passwall2/luasrc/model/cbi/passwall2/server/type/ray.lua +++ b/luci-app-passwall2/luasrc/model/cbi/passwall2/server/type/ray.lua @@ -200,7 +200,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") @@ -227,13 +226,6 @@ o = s:option(Value, _n("httpupgrade_path"), translate("HttpUpgrade Path")) o.placeholder = "/" o:depends({ [_n("transport")] = "httpupgrade" }) --- [[ 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" }) - -- [[ SplitHTTP部分 ]]-- o = s:option(Value, _n("xhttp_host"), translate("XHTTP Host")) o:depends({ [_n("transport")] = "xhttp" }) diff --git a/luci-app-passwall2/luasrc/passwall2/api.lua b/luci-app-passwall2/luasrc/passwall2/api.lua index 976f2a3ea..382a7412e 100644 --- a/luci-app-passwall2/luasrc/passwall2/api.lua +++ b/luci-app-passwall2/luasrc/passwall2/api.lua @@ -1065,7 +1065,7 @@ end function get_version() local version = sys.exec("opkg list-installed luci-app-passwall2 2>/dev/null | awk '{print $3}'") if not version or #version == 0 then - version = sys.exec("apk info luci-app-passwall2 2>/dev/null | awk 'NR == 1 {print $1}' | cut -d'-' -f4-") + version = sys.exec("apk info -L luci-app-passwall2 2>/dev/null | awk 'NR == 1 {print $1}' | cut -d'-' -f4-") end return version or "" end diff --git a/luci-app-passwall2/luasrc/passwall2/util_xray.lua b/luci-app-passwall2/luasrc/passwall2/util_xray.lua index 5eee2e78a..028dc7c7b 100644 --- a/luci-app-passwall2/luasrc/passwall2/util_xray.lua +++ b/luci-app-passwall2/luasrc/passwall2/util_xray.lua @@ -188,12 +188,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 { @@ -485,9 +479,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, diff --git a/luci-app-passwall2/luasrc/view/passwall2/node_list/link_share_man.htm b/luci-app-passwall2/luasrc/view/passwall2/node_list/link_share_man.htm index 42d8ddb1c..1f72fa3b6 100644 --- a/luci-app-passwall2/luasrc/view/passwall2/node_list/link_share_man.htm +++ b/luci-app-passwall2/luasrc/view/passwall2/node_list/link_share_man.htm @@ -792,16 +792,22 @@ local api = require "luci.passwall2.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") { @@ -830,8 +836,14 @@ local api = require "luci.passwall2.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); @@ -906,16 +918,22 @@ local api = require "luci.passwall2.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") { @@ -944,8 +962,14 @@ local api = require "luci.passwall2.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); @@ -1012,7 +1036,14 @@ local api = require "luci.passwall2.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) { @@ -1040,9 +1071,15 @@ local api = require "luci.passwall2.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); @@ -1116,16 +1153,22 @@ local api = require "luci.passwall2.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") { @@ -1154,8 +1197,14 @@ local api = require "luci.passwall2.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); diff --git a/luci-app-passwall2/root/usr/share/passwall2/iptables.sh b/luci-app-passwall2/root/usr/share/passwall2/iptables.sh index db88fc7a9..4f6039adb 100755 --- a/luci-app-passwall2/root/usr/share/passwall2/iptables.sh +++ b/luci-app-passwall2/root/usr/share/passwall2/iptables.sh @@ -940,7 +940,7 @@ add_firewall_rule() { # 加载ACLS load_acl - filter_direct_node_list + filter_direct_node_list > /dev/null 2>&1 & echolog "防火墙规则加载完成!" } diff --git a/luci-app-passwall2/root/usr/share/passwall2/nftables.sh b/luci-app-passwall2/root/usr/share/passwall2/nftables.sh index 7987ebded..1066ea6a6 100755 --- a/luci-app-passwall2/root/usr/share/passwall2/nftables.sh +++ b/luci-app-passwall2/root/usr/share/passwall2/nftables.sh @@ -990,7 +990,7 @@ add_firewall_rule() { # 加载ACLS load_acl - filter_direct_node_list + filter_direct_node_list > /dev/null 2>&1 & echolog "防火墙规则加载完成!" } diff --git a/luci-app-passwall2/root/usr/share/passwall2/subscribe.lua b/luci-app-passwall2/root/usr/share/passwall2/subscribe.lua index 331f1108d..6ed4ca459 100755 --- a/luci-app-passwall2/root/usr/share/passwall2/subscribe.lua +++ b/luci-app-passwall2/root/usr/share/passwall2/subscribe.lua @@ -452,7 +452,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 @@ -472,9 +477,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 @@ -658,7 +669,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 @@ -679,15 +695,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 @@ -809,7 +826,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 @@ -829,15 +851,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 @@ -944,7 +967,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 @@ -964,15 +992,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