luci-app-passwall2: sync upstream

This commit is contained in:
sbwml 2023-09-08 14:33:51 +08:00
parent c8e3598502
commit 9bdb794d3f
5 changed files with 61 additions and 13 deletions

View File

@ -5,7 +5,7 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-passwall2 PKG_NAME:=luci-app-passwall2
PKG_VERSION:=1.20-5 PKG_VERSION:=1.20-6
PKG_RELEASE:= PKG_RELEASE:=
PKG_CONFIG_DEPENDS:= \ PKG_CONFIG_DEPENDS:= \

View File

@ -325,6 +325,9 @@ if singbox_tags:find("with_quic") then
o = s:option(Flag, option_name("hysteria_disable_mtu_discovery"), translate("Disable MTU detection")) o = s:option(Flag, option_name("hysteria_disable_mtu_discovery"), translate("Disable MTU detection"))
o:depends({ [option_name("protocol")] = "hysteria" }) o:depends({ [option_name("protocol")] = "hysteria" })
o = s:option(Value, option_name("hysteria_alpn"), translate("QUIC TLS ALPN"))
o:depends({ [option_name("protocol")] = "hysteria" })
end end
if singbox_tags:find("with_quic") then if singbox_tags:find("with_quic") then
@ -408,10 +411,16 @@ o:depends({ [option_name("tls")] = true })
o = s:option(Value, option_name("tls_serverName"), translate("Domain")) o = s:option(Value, option_name("tls_serverName"), translate("Domain"))
o:depends({ [option_name("tls")] = true }) o:depends({ [option_name("tls")] = true })
o:depends({ [option_name("protocol")] = "hysteria"})
o:depends({ [option_name("protocol")] = "tuic" })
o:depends({ [option_name("protocol")] = "hysteria2" })
o = s:option(Flag, option_name("tls_allowInsecure"), translate("allowInsecure"), translate("Whether unsafe connections are allowed. When checked, Certificate validation will be skipped.")) o = s:option(Flag, option_name("tls_allowInsecure"), translate("allowInsecure"), translate("Whether unsafe connections are allowed. When checked, Certificate validation will be skipped."))
o.default = "0" o.default = "0"
o:depends({ [option_name("tls")] = true }) o:depends({ [option_name("tls")] = true })
o:depends({ [option_name("protocol")] = "hysteria"})
o:depends({ [option_name("protocol")] = "tuic" })
o:depends({ [option_name("protocol")] = "hysteria2" })
if singbox_tags:find("with_utls") then if singbox_tags:find("with_utls") then
o = s:option(Flag, option_name("utls"), translate("uTLS")) o = s:option(Flag, option_name("utls"), translate("uTLS"))

View File

@ -398,9 +398,8 @@ for key, value in pairs(s.fields) do
s.fields[key].write = rm_prefix_write s.fields[key].write = rm_prefix_write
s.fields[key].remove = rm_prefix_remove s.fields[key].remove = rm_prefix_remove
end end
end
local deps = s.fields[key].deps local deps = s.fields[key].deps
if #deps > 0 then if #deps > 0 then
for index, value in ipairs(deps) do for index, value in ipairs(deps) do
deps[index]["type"] = type_name deps[index]["type"] = type_name
@ -408,4 +407,5 @@ for key, value in pairs(s.fields) do
else else
s.fields[key]:depends({ type = type_name }) s.fields[key]:depends({ type = type_name })
end end
end
end end

View File

@ -131,6 +131,9 @@ if singbox_tags:find("with_quic") then
o = s:option(Flag, option_name("hysteria_disable_mtu_discovery"), translate("Disable MTU detection")) o = s:option(Flag, option_name("hysteria_disable_mtu_discovery"), translate("Disable MTU detection"))
o:depends({ [option_name("protocol")] = "hysteria" }) o:depends({ [option_name("protocol")] = "hysteria" })
o = s:option(Value, option_name("hysteria_alpn"), translate("QUIC TLS ALPN"))
o:depends({ [option_name("protocol")] = "hysteria" })
end end
if singbox_tags:find("with_quic") then if singbox_tags:find("with_quic") then
@ -245,6 +248,9 @@ 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")] = "hysteria" })
o:depends({ [option_name("protocol")] = "tuic" })
o:depends({ [option_name("protocol")] = "hysteria2" })
o.validate = function(self, value, t) o.validate = function(self, value, t)
if value and value ~= "" then if value and value ~= "" then
if not nixio.fs.access(value) then if not nixio.fs.access(value) then
@ -259,6 +265,9 @@ 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")] = "hysteria" })
o:depends({ [option_name("protocol")] = "tuic" })
o:depends({ [option_name("protocol")] = "hysteria2" })
o.validate = function(self, value, t) o.validate = function(self, value, t)
if value and value ~= "" then if value and value ~= "" then
if not nixio.fs.access(value) then if not nixio.fs.access(value) then

View File

@ -264,8 +264,8 @@ function gen_outbound(flag, node, tag, proxy_table)
if node.protocol == "hysteria" then if node.protocol == "hysteria" then
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",
up_mbps = tonumber(node.hysteria_up_mbps), up_mbps = tonumber(node.hysteria_up_mbps),
down_mbps = tonumber(node.hysteria_down_mbps), down_mbps = tonumber(node.hysteria_down_mbps),
obfs = node.hysteria_obfs, obfs = node.hysteria_obfs,
@ -274,7 +274,14 @@ function gen_outbound(flag, node, tag, proxy_table)
recv_window_conn = tonumber(node.hysteria_recv_window_conn), recv_window_conn = tonumber(node.hysteria_recv_window_conn),
recv_window = tonumber(node.hysteria_recv_window), recv_window = tonumber(node.hysteria_recv_window),
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,
server_name = node.tls_serverName,
insecure = (node.tls_allowInsecure == "1") and true or false,
alpn = (node.hysteria_alpn and node.hysteria_alpn ~= "") and {
node.hysteria_alpn
} or nil
}
} }
end end
@ -295,7 +302,11 @@ function gen_outbound(flag, node, tag, proxy_table)
udp_over_stream = false, udp_over_stream = false,
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 = tonumber(node.tuic_heartbeat), heartbeat = tonumber(node.tuic_heartbeat),
tls = tls, tls = {
enabled = true,
server_name = node.tls_serverName,
insecure = (node.tls_allowInsecure == "1") and true or false,
},
} }
end end
@ -308,7 +319,11 @@ function gen_outbound(flag, node, tag, proxy_table)
password = node.hysteria2_obfs_password password = node.hysteria2_obfs_password
}, },
password = node.hysteria2_auth_password or nil, password = node.hysteria2_auth_password or nil,
tls = tls, tls = {
enabled = true,
server_name = node.tls_serverName,
insecure = (node.tls_allowInsecure == "1") and true or false,
},
} }
end end
@ -490,8 +505,8 @@ function gen_config_server(node)
if node.protocol == "hysteria" then if node.protocol == "hysteria" then
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",
up_mbps = tonumber(node.hysteria_up_mbps), up_mbps = tonumber(node.hysteria_up_mbps),
down_mbps = tonumber(node.hysteria_down_mbps), down_mbps = tonumber(node.hysteria_down_mbps),
obfs = node.hysteria_obfs, obfs = node.hysteria_obfs,
@ -506,7 +521,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
@ -522,7 +544,11 @@ 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,
}
} }
end end
@ -541,7 +567,11 @@ 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