luci: remove Xray old XTLS version

The old version of XTLS, which is deprecated now and will be removed soon. Please use flow "xtls-rprx-vision" with "tls & tlsSettings" instead.
This commit is contained in:
xiaorouji 2023-02-04 15:43:57 +08:00 committed by sbwml
parent 448f8e5491
commit 28d52193ac
6 changed files with 10 additions and 95 deletions

View File

@ -131,9 +131,6 @@ function gen_outbound(node, tag, proxy_table)
else else
if node.tls and node.tls == "1" then if node.tls and node.tls == "1" then
node.stream_security = "tls" node.stream_security = "tls"
if node.type == "Xray" and node.xtls and node.xtls == "1" then
node.stream_security = "xtls"
end
end end
end end
@ -144,7 +141,7 @@ function gen_outbound(node, tag, proxy_table)
tag = tag, tag = tag,
proxySettings = node.proxySettings or nil, proxySettings = node.proxySettings or nil,
protocol = node.protocol, protocol = node.protocol,
mux = (node.stream_security ~= "xtls") and { mux = {
enabled = (node.mux == "1") and true or false, enabled = (node.mux == "1") and true or false,
concurrency = (node.mux_concurrency) and tonumber(node.mux_concurrency) or 8 concurrency = (node.mux_concurrency) and tonumber(node.mux_concurrency) or 8
} or nil, } or nil,
@ -156,11 +153,6 @@ function gen_outbound(node, tag, proxy_table)
}, },
network = node.transport, network = node.transport,
security = node.stream_security, security = node.stream_security,
xtlsSettings = (node.stream_security == "xtls") and {
serverName = node.tls_serverName,
allowInsecure = (node.tls_allowInsecure == "1") and true or false,
fingerprint = (node.type == "Xray" and node.fingerprint and node.fingerprint ~= "disable") and node.fingerprint or nil
} or nil,
tlsSettings = (node.stream_security == "tls") and { tlsSettings = (node.stream_security == "tls") and {
serverName = node.tls_serverName, serverName = node.tls_serverName,
allowInsecure = (node.tls_allowInsecure == "1") and true or false, allowInsecure = (node.tls_allowInsecure == "1") and true or false,
@ -228,7 +220,7 @@ function gen_outbound(node, tag, proxy_table)
level = 0, level = 0,
security = (node.protocol == "vmess") and node.security or nil, security = (node.protocol == "vmess") and node.security or nil,
encryption = node.encryption or "none", encryption = node.encryption or "none",
flow = node.flow or (node.tls == '1' and node.xtls ~= '1' and node.tlsflow) and node.tlsflow or nil flow = (node.protocol == "vless" and node.tls == '1' and node.tlsflow) and node.tlsflow or nil
} }
} }
} }
@ -238,7 +230,6 @@ function gen_outbound(node, tag, proxy_table)
address = node.address, address = node.address,
port = tonumber(node.port), port = tonumber(node.port),
method = node.method or nil, method = node.method or nil,
flow = node.flow or (node.tls == '1' and node.xtls ~= '1' and node.tlsflow) and node.tlsflow or nil,
ivCheck = (node.protocol == "shadowsocks") and node.iv_check == "1" or nil, ivCheck = (node.protocol == "shadowsocks") and node.iv_check == "1" or nil,
uot = (node.protocol == "shadowsocks") and node.uot == "1" or nil, uot = (node.protocol == "shadowsocks") and node.uot == "1" or nil,
password = node.password or "", password = node.password or "",
@ -273,9 +264,6 @@ function gen_outbound(node, tag, proxy_table)
if result.streamSettings.tlsSettings then if result.streamSettings.tlsSettings then
result.streamSettings.tlsSettings.alpn = alpn result.streamSettings.tlsSettings.alpn = alpn
end end
if result.streamSettings.xtlsSettings then
result.streamSettings.xtlsSettings.alpn = alpn
end
end end
end end
return result return result

View File

@ -512,27 +512,12 @@ tls:depends("type", "Trojan")
tls:depends("type", "Trojan-Plus") tls:depends("type", "Trojan-Plus")
tls:depends("type", "Trojan-Go") tls:depends("type", "Trojan-Go")
xtls = s:option(Flag, "xtls", translate("XTLS"))
xtls.default = 0
xtls:depends({ type = "Xray", protocol = "vless", tls = true })
xtls:depends({ type = "Xray", protocol = "trojan", tls = true })
tlsflow = s:option(Value, "tlsflow", translate("flow")) tlsflow = s:option(Value, "tlsflow", translate("flow"))
tlsflow.default = "" tlsflow.default = ""
tlsflow:value("", translate("Disable")) tlsflow:value("", translate("Disable"))
tlsflow:value("xtls-rprx-vision") tlsflow:value("xtls-rprx-vision")
tlsflow:value("xtls-rprx-vision-udp443") tlsflow:value("xtls-rprx-vision-udp443")
tlsflow:depends({ type = "Xray", protocol = "vless", tls = true , xtls = false }) tlsflow:depends({ type = "Xray", protocol = "vless", tls = true })
flow = s:option(Value, "flow", translate("flow"))
flow.default = "xtls-rprx-direct"
flow:value("xtls-rprx-origin")
flow:value("xtls-rprx-origin-udp443")
flow:value("xtls-rprx-direct")
flow:value("xtls-rprx-direct-udp443")
flow:value("xtls-rprx-splice")
flow:value("xtls-rprx-splice-udp443")
flow:depends("xtls", true)
alpn = s:option(ListValue, "alpn", translate("alpn")) alpn = s:option(ListValue, "alpn", translate("alpn"))
alpn.default = "default" alpn.default = "default"
@ -591,8 +576,7 @@ xray_fingerprint:value("qq")
xray_fingerprint:value("random") xray_fingerprint:value("random")
xray_fingerprint:value("randomized") xray_fingerprint:value("randomized")
xray_fingerprint.default = "disable" xray_fingerprint.default = "disable"
xray_fingerprint:depends({ type = "Xray", tls = true, xtls = false }) xray_fingerprint:depends({ type = "Xray", tls = true })
xray_fingerprint:depends({ type = "Xray", tls = true, xtls = true })
function xray_fingerprint.cfgvalue(self, section) function xray_fingerprint.cfgvalue(self, section)
return m:get(section, "fingerprint") return m:get(section, "fingerprint")
end end
@ -837,13 +821,13 @@ mux:depends("type", "Trojan-Go")
-- [[ Mux ]]-- -- [[ Mux ]]--
mux = s:option(Flag, "mux", translate("Mux")) mux = s:option(Flag, "mux", translate("Mux"))
mux:depends({ type = "V2ray", protocol = "vmess" }) mux:depends({ type = "V2ray", protocol = "vmess" })
mux:depends({ type = "V2ray", protocol = "vless", xtls = false }) mux:depends({ type = "V2ray", protocol = "vless" })
mux:depends({ type = "V2ray", protocol = "http" }) mux:depends({ type = "V2ray", protocol = "http" })
mux:depends({ type = "V2ray", protocol = "socks" }) mux:depends({ type = "V2ray", protocol = "socks" })
mux:depends({ type = "V2ray", protocol = "shadowsocks" }) mux:depends({ type = "V2ray", protocol = "shadowsocks" })
mux:depends({ type = "V2ray", protocol = "trojan" }) mux:depends({ type = "V2ray", protocol = "trojan" })
mux:depends({ type = "Xray", protocol = "vmess" }) mux:depends({ type = "Xray", protocol = "vmess" })
mux:depends({ type = "Xray", protocol = "vless", xtls = false }) mux:depends({ type = "Xray", protocol = "vless" })
mux:depends({ type = "Xray", protocol = "http" }) mux:depends({ type = "Xray", protocol = "http" })
mux:depends({ type = "Xray", protocol = "socks" }) mux:depends({ type = "Xray", protocol = "socks" })
mux:depends({ type = "Xray", protocol = "shadowsocks" }) mux:depends({ type = "Xray", protocol = "shadowsocks" })

View File

@ -14,7 +14,7 @@ function gen_config(user)
for i = 1, #user.uuid do for i = 1, #user.uuid do
clients[i] = { clients[i] = {
id = user.uuid[i], id = user.uuid[i],
flow = ("1" == user.xtls) and user.flow or ("1" == user.tls and "1" ~= user.xtls and user.tlsflow) and user.tlsflow or nil flow = ("vless" == user.protocol and "1" == user.tls and user.tlsflow) and user.tlsflow or nil
} }
end end
settings = { settings = {
@ -57,7 +57,6 @@ function gen_config(user)
local clients = {} local clients = {}
for i = 1, #user.uuid do for i = 1, #user.uuid do
clients[i] = { clients[i] = {
flow = ("1" == user.xtls) and user.flow or ("1" == user.tls and "1" ~= user.xtls and user.tlsflow) and user.tlsflow or nil,
password = user.uuid[i], password = user.uuid[i],
} }
end end
@ -151,15 +150,6 @@ function gen_config(user)
streamSettings = { streamSettings = {
network = user.transport, network = user.transport,
security = "none", security = "none",
xtlsSettings = ("1" == user.tls and "1" == user.xtls) and {
disableSystemRoot = false,
certificates = {
{
certificateFile = user.tls_certificateFile,
keyFile = user.tls_keyFile
}
}
} or nil,
tlsSettings = ("1" == user.tls) and { tlsSettings = ("1" == user.tls) and {
disableSystemRoot = false, disableSystemRoot = false,
certificates = { certificates = {
@ -229,17 +219,10 @@ function gen_config(user)
if config.inbounds[1].streamSettings.tlsSettings then if config.inbounds[1].streamSettings.tlsSettings then
config.inbounds[1].streamSettings.tlsSettings.alpn = alpn config.inbounds[1].streamSettings.tlsSettings.alpn = alpn
end end
if config.inbounds[1].streamSettings.xtlsSettings then
config.inbounds[1].streamSettings.xtlsSettings.alpn = alpn
end
end end
if "1" == user.tls then if "1" == user.tls then
config.inbounds[1].streamSettings.security = "tls" config.inbounds[1].streamSettings.security = "tls"
if user.type == "Xray" and user.xtls and user.xtls == "1" then
config.inbounds[1].streamSettings.security = "xtls"
config.inbounds[1].streamSettings.tlsSettings = nil
end
end end
return config return config

View File

@ -387,23 +387,12 @@ tls:depends("type", "Trojan")
tls:depends("type", "Trojan-Plus") tls:depends("type", "Trojan-Plus")
tls:depends("type", "Trojan-Go") tls:depends("type", "Trojan-Go")
xtls = s:option(Flag, "xtls", translate("XTLS"))
xtls.default = 0
xtls:depends({ type = "Xray", protocol = "vless", tls = true })
xtls:depends({ type = "Xray", protocol = "trojan", tls = true })
tlsflow = s:option(Value, "tlsflow", translate("flow")) tlsflow = s:option(Value, "tlsflow", translate("flow"))
tlsflow.default = "" tlsflow.default = ""
tlsflow:value("", translate("Disable")) tlsflow:value("", translate("Disable"))
tlsflow:value("xtls-rprx-vision") tlsflow:value("xtls-rprx-vision")
tlsflow:value("xtls-rprx-vision-udp443") tlsflow:value("xtls-rprx-vision-udp443")
tlsflow:depends({ type = "Xray", protocol = "vless", tls = true , xtls = false }) tlsflow:depends({ type = "Xray", protocol = "vless", tls = true })
flow = s:option(Value, "flow", translate("flow"))
flow.default = "xtls-rprx-direct"
flow:value("xtls-rprx-origin")
flow:value("xtls-rprx-direct")
flow:depends("xtls", true)
alpn = s:option(ListValue, "alpn", translate("alpn")) alpn = s:option(ListValue, "alpn", translate("alpn"))
alpn.default = "h2,http/1.1" alpn.default = "h2,http/1.1"

View File

@ -297,18 +297,6 @@ local has_xray = api.is_finded("xray")
params += opt.query("sni", "tls_serverName"); params += opt.query("sni", "tls_serverName");
} }
if (opt.get("xtls").checked) {
var v_security = "xtls";
var v_flow = "xtls-rprx-direct";
if (opt.get("flow").value) {
v_flow = opt.get("flow").value;
}
params += "&flow=" + v_flow;
params += "&security=" + v_security;
params += opt.query("sni", "tls_serverName");
}
params += "#" + encodeURI(v_alias.value); params += "#" + encodeURI(v_alias.value);
if (params[0] == "&") { if (params[0] == "&") {
params = params.substring(1); params = params.substring(1);
@ -863,7 +851,6 @@ local has_xray = api.is_finded("xray")
if (queryParam.security) { if (queryParam.security) {
if (queryParam.security == "tls") { if (queryParam.security == "tls") {
opt.set('tls', true); opt.set('tls', true);
opt.set('xtls',false);
opt.set('tlsflow', queryParam.flow || ''); opt.set('tlsflow', queryParam.flow || '');
opt.set('tls_serverName', queryParam.sni || ''); opt.set('tls_serverName', queryParam.sni || '');
opt.set('tls_allowInsecure', true); opt.set('tls_allowInsecure', true);
@ -871,17 +858,6 @@ local has_xray = api.is_finded("xray")
opt.set('tls_allowInsecure', false); opt.set('tls_allowInsecure', false);
} }
} }
if (queryParam.security == "xtls") {
opt.set('tls', true);
opt.set('xtls',true);
opt.set('flow', queryParam.flow || "xtls-rprx-direct");
opt.set('tls_serverName', queryParam.sni || '');
opt.set('tls_allowInsecure', true);
if (queryParam.allowinsecure === '0') {
opt.set('tls_allowInsecure', false);
}
}
} }
queryParam.type = queryParam.type.toLowerCase(); queryParam.type = queryParam.type.toLowerCase();

View File

@ -771,14 +771,9 @@ local function processData(szType, content, add_mode, add_from)
result.encryption = params.encryption or "none" result.encryption = params.encryption or "none"
result.tls = "0" result.tls = "0"
if params.security == "tls" or params.security == "xtls" then if params.security == "tls" then
result.tls = "1" result.tls = "1"
if params.security == "xtls" then result.tlsflow = params.flow or nil
result.xtls = "1"
result.flow = params.flow or "xtls-rprx-direct"
else
result.tlsflow = params.flow or nil
end
result.tls_serverName = (params.sni and params.sni ~= "") and params.sni or params.host result.tls_serverName = (params.sni and params.sni ~= "") and params.sni or params.host
end end