luci: add Mixed support to sing-box server

mixed inbound is a socks4, socks4a, socks5 and http server.
This commit is contained in:
xiaorouji 2023-09-06 16:14:18 +08:00 committed by sbwml
parent 4262fe4238
commit 0163ec8578
2 changed files with 14 additions and 0 deletions

View File

@ -48,6 +48,7 @@ local ss_method_list = {
s.fields["type"]:value(type_name, "Sing-Box")
o = s:option(ListValue, option_name("protocol"), translate("Protocol"))
o:value("mixed", "Mixed")
o:value("socks", "Socks")
o:value("http", "HTTP")
o:value("shadowsocks", "Shadowsocks")
@ -70,6 +71,7 @@ o.validate = function(self, value, t)
end
return value
end
o:depends({ [option_name("protocol")] = "mixed" })
o:depends({ [option_name("protocol")] = "socks" })
o:depends({ [option_name("protocol")] = "http" })

View File

@ -386,6 +386,18 @@ function gen_config_server(node)
local protocol_table = nil
if node.protocol == "mixed" then
protocol_table = {
users = (node.auth == "1") and {
{
username = node.username,
password = node.password
}
} or nil,
set_system_proxy = false
}
end
if node.protocol == "socks" then
protocol_table = {
users = (node.auth == "1") and {