luci: server: fix sing-box
This commit is contained in:
parent
ca0389bd38
commit
53537c90b3
@ -223,6 +223,7 @@ o:depends({ [option_name("protocol")] = "trojan" })
|
|||||||
o = s:option(FileUpload, option_name("tls_certificateFile"), translate("Public key absolute path"), translate("as:") .. "/etc/ssl/fullchain.pem")
|
o = s:option(FileUpload, option_name("tls_certificateFile"), translate("Public key absolute path"), translate("as:") .. "/etc/ssl/fullchain.pem")
|
||||||
o.default = m:get(s.section, "tls_certificateFile") or "/etc/config/ssl/" .. arg[1] .. ".pem"
|
o.default = m:get(s.section, "tls_certificateFile") or "/etc/config/ssl/" .. arg[1] .. ".pem"
|
||||||
o:depends({ [option_name("tls")] = true })
|
o:depends({ [option_name("tls")] = true })
|
||||||
|
o:depends({ [option_name("protocol")] = "naive" })
|
||||||
o:depends({ [option_name("protocol")] = "hysteria" })
|
o:depends({ [option_name("protocol")] = "hysteria" })
|
||||||
o:depends({ [option_name("protocol")] = "tuic" })
|
o:depends({ [option_name("protocol")] = "tuic" })
|
||||||
o:depends({ [option_name("protocol")] = "hysteria2" })
|
o:depends({ [option_name("protocol")] = "hysteria2" })
|
||||||
@ -240,6 +241,7 @@ end
|
|||||||
o = s:option(FileUpload, option_name("tls_keyFile"), translate("Private key absolute path"), translate("as:") .. "/etc/ssl/private.key")
|
o = s:option(FileUpload, option_name("tls_keyFile"), translate("Private key absolute path"), translate("as:") .. "/etc/ssl/private.key")
|
||||||
o.default = m:get(s.section, "tls_keyFile") or "/etc/config/ssl/" .. arg[1] .. ".key"
|
o.default = m:get(s.section, "tls_keyFile") or "/etc/config/ssl/" .. arg[1] .. ".key"
|
||||||
o:depends({ [option_name("tls")] = true })
|
o:depends({ [option_name("tls")] = true })
|
||||||
|
o:depends({ [option_name("protocol")] = "naive" })
|
||||||
o:depends({ [option_name("protocol")] = "hysteria" })
|
o:depends({ [option_name("protocol")] = "hysteria" })
|
||||||
o:depends({ [option_name("protocol")] = "tuic" })
|
o:depends({ [option_name("protocol")] = "tuic" })
|
||||||
o:depends({ [option_name("protocol")] = "hysteria2" })
|
o:depends({ [option_name("protocol")] = "hysteria2" })
|
||||||
|
@ -347,15 +347,11 @@ function gen_config_server(node)
|
|||||||
{ type = "block", tag = "block" }
|
{ type = "block", tag = "block" }
|
||||||
}
|
}
|
||||||
|
|
||||||
local tls = nil
|
local tls = {
|
||||||
|
|
||||||
if node.tls == "1" then
|
|
||||||
tls = {
|
|
||||||
enabled = true,
|
enabled = true,
|
||||||
certificate_path = node.tls_certificateFile,
|
certificate_path = node.tls_certificateFile,
|
||||||
key_path = node.tls_keyFile,
|
key_path = node.tls_keyFile,
|
||||||
}
|
}
|
||||||
end
|
|
||||||
|
|
||||||
local v2ray_transport = nil
|
local v2ray_transport = nil
|
||||||
|
|
||||||
@ -430,7 +426,7 @@ function gen_config_server(node)
|
|||||||
password = node.password
|
password = node.password
|
||||||
}
|
}
|
||||||
} or nil,
|
} or nil,
|
||||||
tls = tls,
|
tls = (node.tls == "1") and tls or nil,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -453,7 +449,7 @@ function gen_config_server(node)
|
|||||||
end
|
end
|
||||||
protocol_table = {
|
protocol_table = {
|
||||||
users = users,
|
users = users,
|
||||||
tls = tls,
|
tls = (node.tls == "1") and tls or nil,
|
||||||
transport = v2ray_transport,
|
transport = v2ray_transport,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
@ -471,7 +467,7 @@ function gen_config_server(node)
|
|||||||
end
|
end
|
||||||
protocol_table = {
|
protocol_table = {
|
||||||
users = users,
|
users = users,
|
||||||
tls = tls,
|
tls = (node.tls == "1") and tls or nil,
|
||||||
transport = v2ray_transport,
|
transport = v2ray_transport,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
@ -483,12 +479,12 @@ function gen_config_server(node)
|
|||||||
for i = 1, #node.uuid do
|
for i = 1, #node.uuid do
|
||||||
users[i] = {
|
users[i] = {
|
||||||
name = node.uuid[i],
|
name = node.uuid[i],
|
||||||
uuid = node.uuid[i],
|
password = node.uuid[i],
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
protocol_table = {
|
protocol_table = {
|
||||||
users = users,
|
users = users,
|
||||||
tls = tls,
|
tls = (node.tls == "1") and tls or nil,
|
||||||
fallback = nil,
|
fallback = nil,
|
||||||
fallback_for_alpn = nil,
|
fallback_for_alpn = nil,
|
||||||
transport = v2ray_transport,
|
transport = v2ray_transport,
|
||||||
@ -509,6 +505,9 @@ function gen_config_server(node)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if node.protocol == "hysteria" then
|
if node.protocol == "hysteria" then
|
||||||
|
tls.alpn = (node.hysteria_alpn and node.hysteria_alpn ~= "") and {
|
||||||
|
node.hysteria_alpn
|
||||||
|
} or nil
|
||||||
protocol_table = {
|
protocol_table = {
|
||||||
up = node.hysteria_up_mbps .. " Mbps",
|
up = node.hysteria_up_mbps .. " Mbps",
|
||||||
down = node.hysteria_down_mbps .. " Mbps",
|
down = node.hysteria_down_mbps .. " Mbps",
|
||||||
@ -526,18 +525,14 @@ function gen_config_server(node)
|
|||||||
recv_window_client = node.hysteria_recv_window_client and tonumber(node.hysteria_recv_window_client) or nil,
|
recv_window_client = node.hysteria_recv_window_client and tonumber(node.hysteria_recv_window_client) or nil,
|
||||||
max_conn_client = node.hysteria_max_conn_client and tonumber(node.hysteria_max_conn_client) or nil,
|
max_conn_client = node.hysteria_max_conn_client and tonumber(node.hysteria_max_conn_client) or nil,
|
||||||
disable_mtu_discovery = (node.hysteria_disable_mtu_discovery == "1") and true or false,
|
disable_mtu_discovery = (node.hysteria_disable_mtu_discovery == "1") and true or false,
|
||||||
tls = {
|
tls = tls
|
||||||
enabled = true,
|
|
||||||
certificate_path = node.tls_certificateFile,
|
|
||||||
key_path = node.tls_keyFile,
|
|
||||||
alpn = (node.hysteria_alpn and node.hysteria_alpn ~= "") and {
|
|
||||||
node.hysteria_alpn
|
|
||||||
} or nil
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
if node.protocol == "tuic" then
|
if node.protocol == "tuic" then
|
||||||
|
tls.alpn = (node.tuic_alpn and node.tuic_alpn ~= "") and {
|
||||||
|
node.tuic_alpn
|
||||||
|
} or nil
|
||||||
protocol_table = {
|
protocol_table = {
|
||||||
users = {
|
users = {
|
||||||
{
|
{
|
||||||
@ -549,14 +544,7 @@ function gen_config_server(node)
|
|||||||
congestion_control = node.tuic_congestion_control or "cubic",
|
congestion_control = node.tuic_congestion_control or "cubic",
|
||||||
zero_rtt_handshake = (node.tuic_zero_rtt_handshake == "1") and true or false,
|
zero_rtt_handshake = (node.tuic_zero_rtt_handshake == "1") and true or false,
|
||||||
heartbeat = node.tuic_heartbeat .. "s",
|
heartbeat = node.tuic_heartbeat .. "s",
|
||||||
tls = {
|
tls = tls
|
||||||
enabled = true,
|
|
||||||
certificate_path = node.tls_certificateFile,
|
|
||||||
key_path = node.tls_keyFile,
|
|
||||||
alpn = (node.tuic_alpn and node.tuic_alpn ~= "") and {
|
|
||||||
node.tuic_alpn
|
|
||||||
} or nil,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -575,11 +563,7 @@ function gen_config_server(node)
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
ignore_client_bandwidth = (node.hysteria2_ignore_client_bandwidth == "1") and true or false,
|
ignore_client_bandwidth = (node.hysteria2_ignore_client_bandwidth == "1") and true or false,
|
||||||
tls = {
|
tls = tls
|
||||||
enabled = true,
|
|
||||||
certificate_path = node.tls_certificateFile,
|
|
||||||
key_path = node.tls_keyFile,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user