From 5c6cfc059e567a7f31b3fb8b8dbc8752b6829a3b Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Sat, 11 Mar 2023 15:46:05 +0800 Subject: [PATCH] luci-app-ssr-plus: add REALITY support Signed-off-by: Tianling Shen --- .../model/cbi/shadowsocksr/client-config.lua | 34 +++++++++++++++---- .../usr/share/shadowsocksr/gen_config.lua | 10 +++++- 2 files changed, 36 insertions(+), 8 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 e1bb5b0cf..bfc04e162 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 @@ -662,12 +662,12 @@ o.rmempty = true o = s:option(Flag, "tls", translate("TLS")) o.rmempty = true o.default = "0" -o:depends({type = "v2ray", v2ray_protocol = "vless"}) -o:depends({type = "v2ray", v2ray_protocol = "vmess"}) -o:depends({type = "v2ray", v2ray_protocol = "trojan"}) -o:depends({type = "v2ray", v2ray_protocol = "shadowsocks"}) -o:depends({type = "v2ray", v2ray_protocol = "socks", socks_ver = "5"}) -o:depends({type = "v2ray", v2ray_protocol = "http"}) +o:depends({type = "v2ray", v2ray_protocol = "vless", reality = false}) +o:depends({type = "v2ray", v2ray_protocol = "vmess", reality = false}) +o:depends({type = "v2ray", v2ray_protocol = "trojan", reality = false}) +o:depends({type = "v2ray", v2ray_protocol = "shadowsocks", reality = false}) +o:depends({type = "v2ray", v2ray_protocol = "socks", socks_ver = "5", reality = false}) +o:depends({type = "v2ray", v2ray_protocol = "http", reality = false}) o:depends("type", "trojan") -- [[ TLS部分 ]] -- @@ -676,6 +676,24 @@ o:depends({type = "trojan", tls = true}) o.default = "0" if is_finded("xray") then + -- [[ REALITY ]] + o = s:option(Flag, "reality", translate("REALITY")) + o.rmempty = true + o.default = "0" + o:depends({type = "v2ray", v2ray_protocol = "vless", tls = false}) + + o = s:option(Value, "reality_publickey", translate("Public key")) + o.rmempty = true + o:depends({type = "v2ray", v2ray_protocol = "vless", reality = true}) + + o = s:option(Value, "reality_shortid", translate("Short ID")) + o.rmempty = true + o:depends({type = "v2ray", v2ray_protocol = "vless", reality = true}) + + o = s:option(Value, "reality_spiderx", translate("spiderX")) + o.rmempty = true + o:depends({type = "v2ray", v2ray_protocol = "vless", reality = true}) + -- [[ XTLS ]]-- o = s:option(Value, "tls_flow", translate("Flow")) for _, v in ipairs(tls_flows) do @@ -683,6 +701,7 @@ if is_finded("xray") then end o.rmempty = true o:depends({type = "v2ray", v2ray_protocol = "vless", transport = "tcp", tls = true}) + o:depends({type = "v2ray", v2ray_protocol = "vless", transport = "tcp", reality = true}) -- [[ uTLS ]]-- o = s:option(Value, "fingerprint", translate("Finger Print")) @@ -699,12 +718,13 @@ if is_finded("xray") then o:value("random", translate("random")) o:value("randomized", translate("randomized")) o:depends({type = "v2ray", tls = true}) - o.default = "" + o:depends({type = "v2ray", reality = true}) end o = s:option(Value, "tls_host", translate("TLS Host")) o.datatype = "hostname" o:depends("tls", true) +o:depends("reality", true) o:depends("type", "hysteria") o.rmempty = true 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 3d9e32a92..589957a62 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 @@ -156,7 +156,7 @@ local Xray = { -- 底层传输配置 streamSettings = { network = server.transport or "tcp", - security = (server.tls == '1') and "tls" or nil, + security = (server.tls == '1') and "tls" or (server.reality == '1') and "reality" or nil, tlsSettings = (server.tls == '1') and { -- tls alpn = server.tls_alpn, @@ -168,6 +168,14 @@ local Xray = { certificateFile = server.certpath } or nil } or nil, + realitySettings = (server.reality == '1') and { + show = false, + publicKey = server.reality_publickey, + shortId = server.reality_shortid, + spiderX = server.reality_spiderx, + fingerprint = server.fingerprint, + serverName = server.tls_host + } or nil, tcpSettings = (server.transport == "tcp" and server.tcp_guise == "http") and { -- tcp header = {