From 89db842e3238172efa215f0f41b1de98f2655c00 Mon Sep 17 00:00:00 2001 From: hecheng337 Date: Tue, 21 Dec 2021 01:04:23 +0800 Subject: [PATCH 1/4] Add health check for h2 & gRPC --- .../model/cbi/shadowsocksr/client-config.lua | 25 +++++++++++++++++++ .../usr/share/shadowsocksr/gen_config.lua | 9 +++++-- 2 files changed, 32 insertions(+), 2 deletions(-) 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 50391a94148..ab563b68dec 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 @@ -383,6 +383,31 @@ o = s:option(Value, "serviceName", translate("serviceName")) o:depends("transport", "grpc") o.rmempty = true +-- H2/gRPC健康检查 +o = s:option(Flag, "health_check", translate("H2/gRPC Health Check")) +o:depends("transport", "h2") +o:depends("transport", "grpc") +o.rmempty = true + +o = s:option(Value, "read_idle_timeout", translate("H2 Read Idle Timeout")) +o:depends({health_check = 1, transport = "h2"}) +o.default = 60 +o.rmempty = true + +o = s:option(Value, "idle_timeout", translate("gRPC Idle Timeout")) +o:depends({health_check = 1, transport = "grpc"}) +o.default = 60 +o.rmempty = true + +o = s:option(Value, "health_check_timeout", translate("Health Check Timeout")) +o:depends("health_check", 1) +o.default = 20 +o.rmempty = true + +o = s:option(Flag, "permit_without_stream", translate("Permit Without Stream")) +o:depends({health_check = 1, transport = "grpc"}) +o.rmempty = true + -- [[ QUIC部分 ]]-- o = s:option(ListValue, "quic_security", translate("QUIC Security")) o:depends("transport", "quic") 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 246ba4a0660..64ec9d0c90d 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 @@ -162,7 +162,9 @@ local Xray = { httpSettings = (server.transport == "h2") and { -- h2 path = server.h2_path or "", - host = {server.h2_host} or nil + host = {server.h2_host} or nil, + read_idle_timeout = tonumber(server.read_idle_timeout) or nil, + health_check_timeout = tonumber(server.health_check_timeout) or nil } or nil, quicSettings = (server.transport == "quic") and { -- quic @@ -173,7 +175,10 @@ local Xray = { grpcSettings = (server.transport == "grpc") and { -- grpc serviceName = server.serviceName or "", - multiMode = (server.mux == "1") and true or false + multiMode = (server.mux == "1") and true or false, + idle_timeout = tonumber(server.idle_timeout) or nil, + health_check_timeout = tonumber(server.health_check_timeout) or nil, + permit_without_stream = (server.permit_without_stream == "1") and true or nil } or nil }, mux = (server.mux == "1" and server.xtls ~= "1" and server.transport ~= "grpc") and { From 9211248629cd8bc9151d8042a06ff650fa0c46c5 Mon Sep 17 00:00:00 2001 From: hecheng337 Date: Tue, 21 Dec 2021 03:11:25 +0800 Subject: [PATCH 2/4] gRPC: add initial_windows_size option --- .../luasrc/model/cbi/shadowsocksr/client-config.lua | 12 +++++++++--- .../root/usr/share/shadowsocksr/gen_config.lua | 3 ++- 2 files changed, 11 insertions(+), 4 deletions(-) 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 ab563b68dec..554c2bec48f 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 @@ -383,6 +383,12 @@ o = s:option(Value, "serviceName", translate("serviceName")) o:depends("transport", "grpc") o.rmempty = true +-- gRPC初始窗口 +o = s:option(Value, "initial_windows_size", translate("Initial Windows Size")) +o:depends("transport", "grpc") +o.default = 0 +o.rmempty = true + -- H2/gRPC健康检查 o = s:option(Flag, "health_check", translate("H2/gRPC Health Check")) o:depends("transport", "h2") @@ -390,12 +396,12 @@ o:depends("transport", "grpc") o.rmempty = true o = s:option(Value, "read_idle_timeout", translate("H2 Read Idle Timeout")) -o:depends({health_check = 1, transport = "h2"}) +o:depends({health_check = true, transport = "h2"}) o.default = 60 o.rmempty = true o = s:option(Value, "idle_timeout", translate("gRPC Idle Timeout")) -o:depends({health_check = 1, transport = "grpc"}) +o:depends({health_check = true, transport = "grpc"}) o.default = 60 o.rmempty = true @@ -405,7 +411,7 @@ o.default = 20 o.rmempty = true o = s:option(Flag, "permit_without_stream", translate("Permit Without Stream")) -o:depends({health_check = 1, transport = "grpc"}) +o:depends({health_check = true, transport = "grpc"}) o.rmempty = true -- [[ QUIC部分 ]]-- 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 64ec9d0c90d..2ce2b03f231 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 @@ -178,7 +178,8 @@ local Xray = { multiMode = (server.mux == "1") and true or false, idle_timeout = tonumber(server.idle_timeout) or nil, health_check_timeout = tonumber(server.health_check_timeout) or nil, - permit_without_stream = (server.permit_without_stream == "1") and true or nil + permit_without_stream = (server.permit_without_stream == "1") and true or nil, + initial_windows_size = tonumber(server.initial_windows_size) or nil } or nil }, mux = (server.mux == "1" and server.xtls ~= "1" and server.transport ~= "grpc") and { From 20328ddac6391ba355b94e2d7fa626e3d93e3186 Mon Sep 17 00:00:00 2001 From: hecheng337 Date: Tue, 21 Dec 2021 03:16:48 +0800 Subject: [PATCH 3/4] Add bloom filter support for Shadowsocks on Xray-core --- .../luasrc/model/cbi/shadowsocksr/client-config.lua | 5 +++++ luci-app-ssr-plus/root/usr/share/shadowsocksr/gen_config.lua | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) 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 554c2bec48f..07d546d503f 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 @@ -256,6 +256,11 @@ end o.rmempty = true o:depends({type = "v2ray", v2ray_protocol = "shadowsocks"}) +o = s:option(Flag, "ivCheck", translate("Bloom Filter")) +o:depends({type = "v2ray", v2ray_protocol = "shadowsocks"}) +o.default = "1" +o.rmempty = false + -- Shadowsocks Plugin o = s:option(Value, "plugin", translate("Obfs")) o:value("none", translate("None")) 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 2ce2b03f231..7a4c687760a 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 @@ -33,7 +33,8 @@ function trojan_shadowsocks() port = tonumber(server.server_port), password = server.password, method = (server.v2ray_protocol == "shadowsocks") and server.encrypt_method_v2ray_ss or nil, - flow = (server.v2ray_protocol == "trojan") and (server.xtls == '1') and (server.vless_flow and server.vless_flow or "xtls-rprx-splice") or nil + flow = (server.v2ray_protocol == "trojan") and (server.xtls == '1') and (server.vless_flow and server.vless_flow or "xtls-rprx-splice") or nil, + ivCheck = (server.v2ray_protocol == "shadowsocks") and (server.ivCheck == '1') or nil } } } From de134c65f44560391b3b5446d7e2d6131826ae2d Mon Sep 17 00:00:00 2001 From: hecheng337 Date: Tue, 21 Dec 2021 03:58:58 +0800 Subject: [PATCH 4/4] Turn off automatically selected TLS --- luci-app-ssr-plus/root/usr/share/shadowsocksr/gen_config.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 7a4c687760a..eec009bf5b8 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 @@ -118,7 +118,7 @@ local Xray = { -- 底层传输配置 streamSettings = { network = server.transport or "tcp", - security = (server.xtls == '1') and "xtls" or (server.tls == '1'or server.transport == "grpc") and "tls" or nil, + security = (server.xtls == '1') and "xtls" or (server.tls == '1') and "tls" or nil, tlsSettings = (server.tls == '1' and (server.insecure == "1" or server.tls_host or server.fingerprint)) and { -- tls fingerprint = server.fingerprint,