From 2c05f921453dec12e28bfb71a57ca0204ae7e235 Mon Sep 17 00:00:00 2001 From: zxl hhyccc <45259624+zxlhhyccc@users.noreply.github.com> Date: Tue, 22 Oct 2024 00:08:02 +0800 Subject: [PATCH 1/2] luci-app-ssr-plus: Fix link failure for latest Xray version. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1、修复Xray更新到2024.9.30版本后,无法连接服务器导致不能科学上网; 2、本次修改兼容1.8.24及以下版本,不过要对应的服务器节点也必须是1.18.24版本及以下,即:客户端是旧版本对应的服务器也是旧版本,客户端是新版本服务器节点也必须是新版本。 3、将 socks 的配置修改为适配最新版本,不适配旧版本的配置。旧版本能否使用请测试。 --- .../usr/share/shadowsocksr/gen_config.lua | 96 ++++++++++--------- 1 file changed, 50 insertions(+), 46 deletions(-) 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 8102cd3859d..66e1fea2de3 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 @@ -125,61 +125,63 @@ local Xray = { loglevel = "warning" }, -- 传入连接 - inbound = (local_port ~= "0") and { - -- listening - port = tonumber(local_port), - protocol = "dokodemo-door", - settings = {network = proto, followRedirect = true}, - sniffing = { - enabled = true, - destOverride = {"http", "tls", "quic"}, - domainsExcluded = { - "courier.push.apple.com", - "rbsxbxp-mim.vivox.com", - "rbsxbxp.www.vivox.com", - "rbsxbxp-ws.vivox.com", - "rbspsxp.www.vivox.com", - "rbspsxp-mim.vivox.com", - "rbspsxp-ws.vivox.com", - "rbswxp.www.vivox.com", - "rbswxp-mim.vivox.com", - "disp-rbspsp-5-1.vivox.com", - "disp-rbsxbp-5-1.vivox.com", - "proxy.rbsxbp.vivox.com", - "proxy.rbspsp.vivox.com", - "proxy.rbswp.vivox.com", - "rbswp.vivox.com", - "rbsxbp.vivox.com", - "rbspsp.vivox.com", - "rbspsp.www.vivox.com", - "rbswp.www.vivox.com", - "rbsxbp.www.vivox.com", - "rbsxbxp.vivox.com", - "rbspsxp.vivox.com", - "rbswxp.vivox.com", - "Mijia Cloud", - "dlg.io.mi.com" - } - } - } or nil, + inbounds = (local_port ~= "0") and { -- 开启 socks 代理 - inboundDetour = (proto:find("tcp") and socks_port ~= "0") and { { -- socks protocol = "socks", - port = tonumber(socks_port), + port = (proto:find("tcp") and socks_port ~= "0") and tonumber(socks_port), settings = {auth = "noauth", udp = true} - } - } or nil, + } or nil, + { + -- listening + port = tonumber(local_port), + protocol = "dokodemo-door", + settings = {network = proto, followRedirect = true}, + metadataOnly = false, + sniffing = { + enabled = true, + destOverride = {"http", "tls", "quic"}, + domainsExcluded = { + "courier.push.apple.com", + "rbsxbxp-mim.vivox.com", + "rbsxbxp.www.vivox.com", + "rbsxbxp-ws.vivox.com", + "rbspsxp.www.vivox.com", + "rbspsxp-mim.vivox.com", + "rbspsxp-ws.vivox.com", + "rbswxp.www.vivox.com", + "rbswxp-mim.vivox.com", + "disp-rbspsp-5-1.vivox.com", + "disp-rbsxbp-5-1.vivox.com", + "proxy.rbsxbp.vivox.com", + "proxy.rbspsp.vivox.com", + "proxy.rbswp.vivox.com", + "rbswp.vivox.com", + "rbsxbp.vivox.com", + "rbspsp.vivox.com", + "rbspsp.www.vivox.com", + "rbswp.www.vivox.com", + "rbsxbp.www.vivox.com", + "rbsxbxp.vivox.com", + "rbspsxp.vivox.com", + "rbswxp.vivox.com", + "Mijia Cloud", + "dlg.io.mi.com" + } + } + } or nil, + }, -- 传出连接 - outbound = { + outbounds = { + { protocol = server.v2ray_protocol, settings = outbound_settings, -- 底层传输配置 streamSettings = (server.v2ray_protocol ~= "wireguard") and { network = server.transport or "tcp", security = (server.xtls == '1') and "xtls" or (server.tls == '1') and "tls" or (server.reality == '1') and "reality" or nil, - tlsSettings = (server.tls == '1') and (server.tls_host or server.fingerprint) and { + tlsSettings = (server.tls == '1') and { -- tls alpn = server.tls_alpn, fingerprint = server.fingerprint, @@ -269,6 +271,7 @@ local Xray = { initial_windows_size = tonumber(server.initial_windows_size) or nil } or nil, sockopt = { + mark = 255, tcpMptcp = (server.mptcp == "1") and true or false, -- MPTCP tcpNoDelay = (server.mptcp == "1") and true or false, -- MPTCP tcpcongestion = server.custom_tcpcongestion -- 连接服务器节点的 TCP 拥塞控制算法 @@ -280,7 +283,8 @@ local Xray = { concurrency = tonumber(server.concurrency), -- TCP 最大并发连接数 xudpConcurrency = tonumber(server.xudpConcurrency), -- UDP 最大并发连接数 xudpProxyUDP443 = server.xudpProxyUDP443 -- 对被代理的 UDP/443 流量处理方式 - } or nil + } or nil, + } } } local cipher = "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA:AES128-SHA:AES256-SHA:DES-CBC3-SHA" @@ -351,7 +355,7 @@ local hysteria = { 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) } or nil, @@ -488,7 +492,7 @@ local tuic = { }, ["local"] = { server = tonumber(socks_port) and "[::]:" .. (socks_port == "0" and local_port or tonumber(socks_port)), - dual_stack = (server.tuic_dual_stack == "1") and true or nil, + dual_stack = (server.tuic_dual_stack == "1") and true or nil, max_packet_size = tonumber(server.tuic_max_package_size) } } From f2a479edcf97e2347cf580f340cfd0431a8879f4 Mon Sep 17 00:00:00 2001 From: zxl hhyccc <45259624+zxlhhyccc@users.noreply.github.com> Date: Tue, 22 Oct 2024 00:10:16 +0800 Subject: [PATCH 2/2] luci-app-ssr-plus: Fix link failure for latest Xray version. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1、修复Xray更新到2024.9.30版本后,无法连接服务器导致不能科学上网; 2、本次修改兼容1.8.24及以下版本,不过要对应的服务器节点也必须是1.18.24版本及以下,即:客户端是旧版本对应的服务器也是旧版本,客户端是新版本服务器节点也必须是新版本。 3、将 socks 的配置修改为适配最新版本,不适配旧版本的配置。旧版本能否使用请测试。 --- luci-app-ssr-plus/root/etc/init.d/shadowsocksr | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/luci-app-ssr-plus/root/etc/init.d/shadowsocksr b/luci-app-ssr-plus/root/etc/init.d/shadowsocksr index d62f5ab37c5..92053131a83 100755 --- a/luci-app-ssr-plus/root/etc/init.d/shadowsocksr +++ b/luci-app-ssr-plus/root/etc/init.d/shadowsocksr @@ -745,14 +745,19 @@ Start_Run() { echolog "Main node:$(get_name $type) $threads Threads Started!" ;; v2ray) + local version=$($(first_type xray v2ray) version | head -1 | awk '{print $2}') + local xray_protocol=$(uci_get_by_name $GLOBAL_SERVER v2ray_protocol) gen_config_file $GLOBAL_SERVER $type 1 $tcp_port $socks_port ln_start_bin $(first_type xray v2ray) v2ray run -config $tcp_config_file + if [ "$xray_protocol" = "vless" ] && [ "$(echo -e "$version\n1.18.24" | sort -V)" ]; then + ARG_UDP="" + fi echolog "Main node:$($(first_type xray v2ray) version | head -1) Started!" ;; trojan) gen_config_file $GLOBAL_SERVER $type 1 $tcp_port for i in $(seq 1 $threads); do - ln_start_bin $(first_type $type) $type --config $tcp_config_file + ln_start_bin $(first_type $type) $type --config $tcp_config_file done echolog "Main node:$($(first_type $type) --version 2>&1 | head -1) , $threads Threads Started!" ;;