From d7a1ce6f6b318698cd9684bbcca1cef60b0beb58 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 20 Feb 2024 02:11:48 +0800 Subject: [PATCH] update 2024-02-20 02:11:48 --- luci-app-passwall2/Makefile | 2 +- .../model/cbi/passwall2/client/other.lua | 18 ++++++- .../model/cbi/passwall2/client/type/ray.lua | 7 +++ .../luasrc/passwall2/util_xray.lua | 44 ++++++++++++++-- .../luasrc/view/passwall2/global/status.htm | 6 +-- luci-app-passwall2/po/zh-cn/passwall2.po | 27 ++++++++++ .../model/cbi/shadowsocksr/client-config.lua | 52 ++++++++++--------- luci-app-ssr-plus/po/zh-cn/ssr-plus.po | 3 ++ .../root/etc/init.d/shadowsocksr | 8 +-- .../usr/share/shadowsocksr/gen_config.lua | 15 +++--- 10 files changed, 137 insertions(+), 45 deletions(-) diff --git a/luci-app-passwall2/Makefile b/luci-app-passwall2/Makefile index 428b2245..f473ed26 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:=1.25-5 +PKG_VERSION:=1.26-1 PKG_RELEASE:= PKG_CONFIG_DEPENDS:= \ diff --git a/luci-app-passwall2/luasrc/model/cbi/passwall2/client/other.lua b/luci-app-passwall2/luasrc/model/cbi/passwall2/client/other.lua index 27538051..0c03cf3d 100644 --- a/luci-app-passwall2/luasrc/model/cbi/passwall2/client/other.lua +++ b/luci-app-passwall2/luasrc/model/cbi/passwall2/client/other.lua @@ -141,9 +141,25 @@ if has_xray then s_xray.anonymous = true s_xray.addremove = false + o = s_xray:option(Flag, "fragment", translate("Fragment"), translate("TCP fragments, which can deceive the censorship system in some cases, such as bypassing SNI blacklists.")) + o.default = 0 + + o = s_xray:option(ListValue, "fragment_packets", translate("Fragment Packets"), translate(" \"1-3\" is for segmentation at TCP layer, applying to the beginning 1 to 3 data writes by the client. \"tlshello\" is for TLS client hello packet fragmentation.")) + o.default = "tlshello" + o:value("1-3", "1-3") + o:value("tlshello", "tlshello") + o:depends("fragment", true) + + o = s_xray:option(Value, "fragment_length", translate("Fragment Length"), translate("Fragmented packet length (byte)")) + o.default = "10-20" + o:depends("fragment", true) + + o = s_xray:option(Value, "fragment_interval", translate("Fragment Interval"), translate("Fragmentation interval (ms)")) + o.default = "10-20" + o:depends("fragment", true) + o = s_xray:option(Flag, "sniffing", translate("Sniffing"), translate("When using the shunt, must be enabled, otherwise the shunt will invalid.")) o.default = 1 - o.rmempty = false o = s_xray:option(Flag, "route_only", translate("Sniffing Route Only")) o.default = 0 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 a297b0ac..6118c19d 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 @@ -515,4 +515,11 @@ o = s:option(Value, option_name("xudp_concurrency"), translate("XUDP Mux concurr o.default = 8 o:depends({ [option_name("xmux")] = true }) +--[[tcpMptcp]] +o = s:option(Flag, option_name("tcpMptcp"), "tcpMptcp", translate("Enable Multipath TCP, need to be enabled in both server and client configuration.")) +o.default = 0 + +o = s:option(Flag, option_name("tcpNoDelay"), "tcpNoDelay") +o.default = 0 + api.luci_types(arg[1], m, s, type_name, option_prefix) diff --git a/luci-app-passwall2/luasrc/passwall2/util_xray.lua b/luci-app-passwall2/luasrc/passwall2/util_xray.lua index f9b8e968..67627130 100644 --- a/luci-app-passwall2/luasrc/passwall2/util_xray.lua +++ b/luci-app-passwall2/luasrc/passwall2/util_xray.lua @@ -43,9 +43,11 @@ function gen_outbound(flag, node, tag, proxy_table) local proxy = 0 local proxy_tag = "nil" + local fragment = nil if proxy_table ~= nil and type(proxy_table) == "table" then proxy = proxy_table.proxy or 0 proxy_tag = proxy_table.tag or "nil" + fragment = proxy_table.fragment or nil end if node.type == "Xray" then @@ -127,7 +129,10 @@ function gen_outbound(flag, node, tag, proxy_table) -- 底层传输配置 streamSettings = (node.streamSettings or node.protocol == "vmess" or node.protocol == "vless" or node.protocol == "socks" or node.protocol == "shadowsocks" or node.protocol == "trojan") and { sockopt = { - mark = 255 + mark = 255, + tcpMptcp = (node.tcpMptcp == "1") and true or nil, + tcpNoDelay = (node.tcpNoDelay == "1") and true or nil, + dialerProxy = fragment and "fragment" or nil }, network = node.transport, security = node.stream_security, @@ -637,7 +642,7 @@ function gen_config(var) end if is_new_blc_node then local blc_node = uci:get_all(appname, blc_node_id) - local outbound = gen_outbound(flag, blc_node, blc_node_tag) + local outbound = gen_outbound(flag, blc_node, blc_node_tag, { fragment = xray_settings.fragment == "1" or nil }) if outbound then table.insert(outbounds, outbound) valid_nodes[#valid_nodes + 1] = blc_node_tag @@ -715,7 +720,7 @@ function gen_config(var) preproxy_enabled = false end elseif preproxy_node and api.is_normal_node(preproxy_node) then - local preproxy_outbound = gen_outbound(flag, preproxy_node, preproxy_tag) + local preproxy_outbound = gen_outbound(flag, preproxy_node, preproxy_tag, { fragment = xray_settings.fragment == "1" or nil }) if preproxy_outbound then table.insert(outbounds, preproxy_outbound) else @@ -817,7 +822,14 @@ function gen_config(var) }) end end - local _outbound = gen_outbound(flag, _node, rule_name, { proxy = proxy and 1 or 0, tag = proxy and preproxy_tag or nil }) + local proxy_table = { + proxy = proxy and 1 or 0, + tag = proxy and preproxy_tag or nil + } + if xray_settings.fragment == "1" and not proxy_table.tag then + proxy_table.fragment = true + end + local _outbound = gen_outbound(flag, _node, rule_name, proxy_table) if _outbound then table.insert(outbounds, _outbound) if proxy then preproxy_used = true end @@ -996,7 +1008,7 @@ function gen_config(var) sys.call("touch /tmp/etc/passwall2/iface/" .. node.iface) end else - outbound = gen_outbound(flag, node) + outbound = gen_outbound(flag, node, nil, { fragment = xray_settings.fragment == "1" or nil }) end if outbound then table.insert(outbounds, outbound) end routing = { @@ -1338,6 +1350,28 @@ function gen_config(var) -- } } } + + if xray_settings.fragment == "1" then + table.insert(outbounds, { + protocol = "freedom", + tag = "fragment", + settings = { + domainStrategy = (direct_dns_query_strategy and direct_dns_query_strategy ~= "") and direct_dns_query_strategy or "UseIP", + fragments = { + packets = (xray_settings.fragment_packets and xray_settings.fragment_packets ~= "") and xray_settings.fragment_packets, + length = (xray_settings.fragment_length and xray_settings.fragment_length ~= "") and xray_settings.fragment_length, + interval = (xray_settings.fragment_interval and xray_settings.fragment_interval ~= "") and xray_settings.fragment_interval + } + }, + streamSettings = { + sockopt = { + mark = 255, + tcpNoDelay = true + } + } + }) + end + table.insert(outbounds, { protocol = "freedom", tag = "direct", diff --git a/luci-app-passwall2/luasrc/view/passwall2/global/status.htm b/luci-app-passwall2/luasrc/view/passwall2/global/status.htm index 58e2821e..66ede854 100644 --- a/luci-app-passwall2/luasrc/view/passwall2/global/status.htm +++ b/luci-app-passwall2/luasrc/view/passwall2/global/status.htm @@ -95,7 +95,7 @@ https://github.com/pure-css/pure/blob/master/LICENSE.md -
+
@@ -107,7 +107,7 @@ https://github.com/pure-css/pure/blob/master/LICENSE.md
-
+
@@ -119,7 +119,7 @@ https://github.com/pure-css/pure/blob/master/LICENSE.md
-
+
diff --git a/luci-app-passwall2/po/zh-cn/passwall2.po b/luci-app-passwall2/po/zh-cn/passwall2.po index 467fc221..2211a316 100644 --- a/luci-app-passwall2/po/zh-cn/passwall2.po +++ b/luci-app-passwall2/po/zh-cn/passwall2.po @@ -1446,3 +1446,30 @@ msgstr "后量子对等证书签名方案" msgid "Disable adaptive sizing of TLS records" msgstr "禁用 TLS 记录的自适应大小调整" + +msgid "Enable Multipath TCP, need to be enabled in both server and client configuration." +msgstr "启用 Multipath TCP,需在服务端和客户端配置中同时启用。" + +msgid "Fragment" +msgstr "分片" + +msgid "TCP fragments, which can deceive the censorship system in some cases, such as bypassing SNI blacklists." +msgstr "TCP 分片,在某些情况下可以欺骗审查系统,比如绕过 SNI 黑名单。" + +msgid "Fragment Packets" +msgstr "分片方式" + +msgid " \"1-3\" is for segmentation at TCP layer, applying to the beginning 1 to 3 data writes by the client. \"tlshello\" is for TLS client hello packet fragmentation." +msgstr " \"1-3\" 是 TCP 的流切片,应用于客户端第 1 至第 3 次写数据。\"tlshello\" 是 TLS 握手包切片。" + +msgid "Fragment Length" +msgstr "分片包长" + +msgid "Fragmented packet length (byte)" +msgstr "分片包长 (byte)" + +msgid "Fragment Interval" +msgstr "分片间隔" + +msgid "Fragmentation interval (ms)" +msgstr "分片间隔(ms)" diff --git a/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/client-config.lua b/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/client-config.lua index 3bdb464c..eb716f06 100644 --- a/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/client-config.lua +++ b/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/client-config.lua @@ -323,33 +323,39 @@ o = s:option(Value, "hy2_auth", translate("Users Authentication")) o:depends("type", "hysteria") o.rmempty = false -o = s:option(ListValue, "transport_protocol", translate("Protocol")) -o:depends("type", "hysteria") -o:value("udp", translate("udp")) -o.default = "udp" -o.rmempty = true - -o = s:option(Flag, "port_hopping", translate("Enable Port Hopping")) +o = s:option(Flag, "flag_port_hopping", translate("Enable Port Hopping")) o:depends("type", "hysteria") o.rmempty = true o.default = "0" -o = s:option(Value, "hopinterval", translate("Port Hopping Interval(Unit:Second)")) -o:depends({type = "hysteria", port_hopping = true}) +o = s:option(Value, "port_range", translate("Port Range")) +o:depends({type = "hysteria", flag_port_hopping = true}) +o.datatype = "portrange" +o.rmempty = true + +o = s:option(Flag, "flag_transport", translate("Enable Transport Protocol Settings")) +o:depends("type", "hysteria") +o.rmempty = true +o.default = "0" + +o = s:option(ListValue, "transport_protocol", translate("Transport Protocol")) +o:depends({type = "hysteria", flag_transport = true}) +o:value("udp", translate("UDP")) +o.default = "udp" +o.rmempty = true + +o = s:option(Value, "hopinterval", translate("Hop Interval(Unit:Second)")) +o:depends({type = "hysteria", flag_transport = true, flag_port_hopping = true}) o.datatype = "uinteger" o.rmempty = true o.default = "30" -o = s:option(Value, "port_range", translate("Port Range")) -o:depends({type = "hysteria", port_hopping = true}) -o.rmempty = true - -o = s:option(Flag, "lazy_mode", translate("Enable Lazy Mode")) +o = s:option(Flag, "flag_obfs", translate("Enable Obfuscation")) o:depends("type", "hysteria") o.rmempty = true o.default = "0" -o = s:option(Flag, "flag_obfs", translate("Enable Obfuscation")) +o = s:option(Flag, "lazy_mode", translate("Lazy Mode")) o:depends("type", "hysteria") o.rmempty = true o.default = "0" @@ -369,6 +375,11 @@ o:depends("type", "hysteria") o.rmempty = true o.default = "0" +o = s:option(Flag, "disablepathmtudiscovery", translate("Disable QUIC path MTU discovery.")) +o:depends({type = "hysteria",flag_quicparam = "1"}) +o.rmempty = true +o.default = false + --[[Hysteria2 QUIC parameters setting]] o = s:option(Value, "initstreamreceivewindow", translate("QUIC initStreamReceiveWindow")) o:depends({type = "hysteria", flag_quicparam = "1"}) @@ -406,11 +417,6 @@ o.rmempty = true o.datatype = "uinteger" o.default = "10" -o = s:option(Flag, "disablepathmtudiscovery", translate("Disable Path MTU discovery")) -o:depends({type = "hysteria", flag_quicparam = "1"}) -o.rmempty = true -o.default = false - --[[ Shadow-TLS Options ]] o = s:option(ListValue, "shadowtls_protocol", translate("shadowTLS protocol Version")) @@ -902,9 +908,7 @@ o:depends("reality", true) o.rmempty = true o = s:option(DynamicList, "tls_alpn", translate("TLS ALPN")) -o:depends("tls", true) -o:depends("type", "tuic") -o:depends("type", "hysteria") +o:depends({type = "tuic", tls = true}) o.rmempty = true -- [[ allowInsecure ]]-- @@ -1187,7 +1191,7 @@ if is_finded("kcptun-client") then o:depends("type", "ss") o = s:option(Value, "kcp_port", translate("KcpTun Port")) - o.datatype = "port" + o.datatype = "portrange" o.default = 4000 o:depends("type", "ssr") o:depends("type", "ss") diff --git a/luci-app-ssr-plus/po/zh-cn/ssr-plus.po b/luci-app-ssr-plus/po/zh-cn/ssr-plus.po index 8d3bdd7e..6e70883e 100644 --- a/luci-app-ssr-plus/po/zh-cn/ssr-plus.po +++ b/luci-app-ssr-plus/po/zh-cn/ssr-plus.po @@ -181,6 +181,9 @@ msgstr "注意: 如果服务器使用 userpass 验证,格式必须是 userna msgid "Enable Port Hopping" msgstr "启用端口跃迁" +msgid "Enable Transport Protocol Settings" +msgstr "启用传输协议设置" + msgid "Port Range" msgstr "端口范围值" diff --git a/luci-app-ssr-plus/root/etc/init.d/shadowsocksr b/luci-app-ssr-plus/root/etc/init.d/shadowsocksr index a9a7e57a..9f269024 100755 --- a/luci-app-ssr-plus/root/etc/init.d/shadowsocksr +++ b/luci-app-ssr-plus/root/etc/init.d/shadowsocksr @@ -433,7 +433,7 @@ start_udp() { hysteria) gen_config_file $UDP_RELAY_SERVER $type 2 $tmp_udp_port ln_start_bin $(first_type hysteria) hysteria client --config $udp_config_file - echolog "UDP TPROXY Relay:$($(first_type "hysteria") version | awk '{print "Hhysteria2: " $2}' | head -9 | tail +9) Started!" + echolog "UDP TPROXY Relay:$($(first_type "hysteria") version | grep Version | awk '{print "Hysteria2:" $2}') Started!" ;; tuic) # FIXME: ipt2socks cannot handle udp reply from tuic @@ -564,7 +564,7 @@ start_shunt() { fi ln_start_bin $(first_type hysteria) hysteria client --config $shunt_config_file shunt_dns_command - echolog "shunt:$($(first_type hysteria) version | awk '{print "Hhysteria2: " $2}' | head -9 | tail +9) Started!" + echolog "shunt:$($(first_type hysteria) version | grep Version | awk '{print "Hysteria2:" $2})' Started!" ;; tuic) local chain_shunt_port="30${tmp_shunt_port}" @@ -663,7 +663,7 @@ start_local() { if [ "$_local" == "2" ]; then gen_config_file $LOCAL_SERVER $type 4 0 $local_port ln_start_bin $(first_type hysteria) hysteria client --config $local_config_file - echolog "Global_Socks5:$($(first_type hysteria) version | awk '{print "Hhysteria2: " $2}' | head -9 | tail +9) Started!" + echolog "Global_Socks5:$($(first_type hysteria) version | grep Version | awk '{print "Hysteria2:" $2}') Started!" fi ;; tuic) @@ -758,7 +758,7 @@ Start_Run() { hysteria) gen_config_file $GLOBAL_SERVER $type 1 $tcp_port $socks_port ln_start_bin $(first_type hysteria) hysteria client --config $tcp_config_file - echolog "Main node:$($(first_type hysteria) version | awk '{print "Hhysteria2: " $2}' | head -9 | tail +9) Started!" + echolog "Main node:$($(first_type hysteria) version | grep Version | awk '{print "Hysteria2:" $2}') Started!" ;; tuic) local PARAM diff --git a/luci-app-ssr-plus/root/usr/share/shadowsocksr/gen_config.lua b/luci-app-ssr-plus/root/usr/share/shadowsocksr/gen_config.lua index 02603c3c..91498b0b 100755 --- a/luci-app-ssr-plus/root/usr/share/shadowsocksr/gen_config.lua +++ b/luci-app-ssr-plus/root/usr/share/shadowsocksr/gen_config.lua @@ -392,7 +392,7 @@ local ss = { reuse_port = true } local hysteria = { - server = (server.port_range and (server.server .. ":" .. server.port_range)) or (server.server_port and (server.server .. ":" .. server.server_port)), + server = (server.server_port and (server.port_range and (server.server .. ":" .. server.server_port .. "," .. server.port_range) or server.server .. ":" .. server.server_port) or (server.port_range and server.server .. ":" .. server.port_range or server.server .. ":443")), bandwidth = { up = tonumber(server.uplink_capacity) and tonumber(server.uplink_capacity) .. " mbps" or nil, down = tonumber(server.downlink_capacity) and tonumber(server.downlink_capacity) .. " mbps" or nil @@ -401,12 +401,13 @@ local hysteria = { listen = "0.0.0.0:" .. tonumber(socks_port), disable_udp = false } or nil, - transport = { - type = server.transport_protocol, - udp = { - hopInterval = tonumber(server.hopinterval) and tonumber(server.hopinterval) .. "s" or "30s" - } - }, + transport = (server.transport_protocol) and { + type = (server.transport_protocol) or udp, + udp = (server.port_range and (server.hopinterval) and { + hopInterval = (server.port_range and (tonumber(server.hopinterval) .. "s") or nil) + } or nil) + } or nil, + --[[ tcpTProxy = (proto:find("tcp") and local_port ~= "0") and { listen = "0.0.0.0:" .. tonumber(local_port)