luci: add Naive support to sing-box server

This commit is contained in:
xiaorouji 2023-09-06 16:15:15 +08:00 committed by sbwml
parent 0163ec8578
commit d38c0532bc
2 changed files with 15 additions and 0 deletions

View File

@ -55,6 +55,7 @@ o:value("shadowsocks", "Shadowsocks")
o:value("vmess", "Vmess")
o:value("vless", "VLESS")
o:value("trojan", "Trojan")
o:value("naive", "Naive")
o:value("direct", "Direct")
o = s:option(Value, option_name("port"), translate("Listen Port"))
@ -77,11 +78,13 @@ o:depends({ [option_name("protocol")] = "http" })
o = s:option(Value, option_name("username"), translate("Username"))
o:depends({ [option_name("auth")] = true })
o:depends({ [option_name("protocol")] = "naive" })
o = s:option(Value, option_name("password"), translate("Password"))
o.password = true
o:depends({ [option_name("auth")] = true })
o:depends({ [option_name("protocol")] = "shadowsocks" })
o:depends({ [option_name("protocol")] = "naive" })
o = s:option(ListValue, option_name("d_protocol"), translate("Destination protocol"))
o:value("tcp", "TCP")

View File

@ -483,6 +483,18 @@ function gen_config_server(node)
end
end
if node.protocol == "naive" then
protocol_table = {
users = {
{
username = node.username,
password = node.password
}
},
tls = tls,
}
end
if node.protocol == "direct" then
protocol_table = {
network = (node.d_protocol ~= "TCP,UDP") and node.d_protocol or nil,