mirror of
https://github.com/caiwx86/small-packages.git
synced 2026-08-01 20:39:36 +08:00
update 2026-05-16 21:11:54
This commit is contained in:
parent
55f11c986d
commit
37f5311fe0
@ -24,19 +24,36 @@ o = s:option(ListValue, _n("protocol"), translate("Protocol"))
|
||||
o:value("udp", "UDP")
|
||||
|
||||
o = s:option(Value, _n("address"), translate("Address (Support Domain Name)"))
|
||||
o:depends({ [_n("realms")] = false })
|
||||
|
||||
o = s:option(Value, _n("port"), translate("Port"))
|
||||
o.datatype = "port"
|
||||
o:depends({ [_n("realms")] = false })
|
||||
|
||||
o = s:option(Value, _n("hop"), translate("Port hopping range"))
|
||||
o.description = translate("Format as 1000:2000 or 1000-2000 Multiple groups are separated by commas (,).")
|
||||
o.rewrite_option = o.option
|
||||
o:depends({ [_n("realms")] = false })
|
||||
|
||||
o = s:option(Value, _n("hop_interval"), translate("Hop Interval(second)"), translate("Supports a fixed value or a random range (e.g., 30, 5-30), minimum 5."))
|
||||
o.datatype = "or(uinteger,portrange)"
|
||||
o.placeholder = "30"
|
||||
o.default = "30"
|
||||
o.rewrite_option = o.option
|
||||
o:depends({ [_n("realms")] = false })
|
||||
|
||||
o = s:option(Flag, _n("realms"), translate("Realms"))
|
||||
o.default = "0"
|
||||
o.rewrite_option = o.option
|
||||
|
||||
o = s:option(Value, _n("realm_url"), translate("Realm URL"), translate("Example:") .. "realm://public@realm.hy2.io/your-realm-name")
|
||||
o.rewrite_option = o.option
|
||||
o:depends({ [_n("realms")] = "1" })
|
||||
|
||||
o = s:option(DynamicList, _n("realm_stun"), translate("Realm STUN"))
|
||||
o.default = { "stun.sip.us:3478", "stun.nextcloud.com:3478", "global.stun.twilio.com:3478" }
|
||||
o.rewrite_option = o.option
|
||||
o:depends({ [_n("realms")] = "1" })
|
||||
|
||||
o = s:option(Value, _n("auth_password"), translate("Auth Password"))
|
||||
o.password = true
|
||||
|
||||
@ -26,6 +26,20 @@ o = s:option(Value, _n("port"), translate("Listen Port"))
|
||||
o.datatype = "port"
|
||||
o:depends({ [_n("custom")] = false })
|
||||
|
||||
o = s:option(Flag, _n("realms"), translate("Realms"))
|
||||
o.default = "0"
|
||||
o.rewrite_option = o.option
|
||||
o:depends({ [_n("custom")] = false })
|
||||
|
||||
o = s:option(Value, _n("realm_url"), translate("Realm URL"), translate("Example:") .. "realm://public@realm.hy2.io/your-realm-name")
|
||||
o.rewrite_option = o.option
|
||||
o:depends({ [_n("realms")] = "1" })
|
||||
|
||||
o = s:option(DynamicList, _n("realm_stun"), translate("Realm STUN"))
|
||||
o.default = { "stun.sip.us:3478", "stun.nextcloud.com:3478", "global.stun.twilio.com:3478" }
|
||||
o.rewrite_option = o.option
|
||||
o:depends({ [_n("realms")] = "1" })
|
||||
|
||||
o = s:option(Value, _n("auth_password"), translate("Auth Password"))
|
||||
o.password = true
|
||||
o.rewrite_option = o.option
|
||||
|
||||
@ -5,7 +5,16 @@ local jsonc = api.jsonc
|
||||
|
||||
function gen_config_server(node)
|
||||
local config = {
|
||||
listen = ":" .. node.port,
|
||||
listen = (function()
|
||||
if node.hysteria2_realms and node.hysteria2_realm_url then
|
||||
local url = node.hysteria2_realm_url:gsub("/+$", "")
|
||||
if node.port then
|
||||
url = url .. (url:find("?") and "&lport=" or "?lport=") .. node.port
|
||||
end
|
||||
return url
|
||||
end
|
||||
return ":" .. (node.port or "0")
|
||||
end)(),
|
||||
tls = {
|
||||
cert = node.tls_certificateFile,
|
||||
key = node.tls_keyFile,
|
||||
@ -26,6 +35,9 @@ function gen_config_server(node)
|
||||
} or nil,
|
||||
ignoreClientBandwidth = (node.hysteria2_ignoreClientBandwidth == "1") and true or false,
|
||||
disableUDP = (node.hysteria2_udp == "0") and true or false,
|
||||
realm = (node.hysteria2_realms and node.hysteria2_realm_stun) and {
|
||||
stunServers = node.hysteria2_realm_stun
|
||||
} or nil
|
||||
}
|
||||
return config
|
||||
end
|
||||
@ -49,7 +61,7 @@ function gen_config(var)
|
||||
local local_http_password = var["local_http_password"]
|
||||
local tcp_proxy_way = var["tcp_proxy_way"]
|
||||
local server_host = var["server_host"] or (node.address or ""):lower()
|
||||
local server_port = var["server_port"] or node.port
|
||||
local server_port = var["server_port"] or (node.port or "443")
|
||||
|
||||
if api.is_ipv6(server_host) then
|
||||
server_host = api.get_ipv6_full(server_host)
|
||||
@ -61,7 +73,15 @@ function gen_config(var)
|
||||
end
|
||||
|
||||
local config = {
|
||||
server = server,
|
||||
server = (function()
|
||||
if node.hysteria2_realms and node.hysteria2_realm_url then
|
||||
return node.hysteria2_realm_url:gsub("/+$", "")
|
||||
end
|
||||
return server
|
||||
end)(),
|
||||
realm = (node.hysteria2_realms and node.hysteria2_realm_stun) and {
|
||||
stunServers = node.hysteria2_realm_stun
|
||||
} or nil,
|
||||
transport = {
|
||||
type = "udp",
|
||||
udp = node.hysteria2_hop and (function()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user