luci-app-ssr-plus: add REALITY support

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
Tianling Shen 2023-03-11 15:46:05 +08:00 committed by sbwml
parent fd8c26b831
commit 5c6cfc059e
2 changed files with 36 additions and 8 deletions

View File

@ -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

View File

@ -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 = {