mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-16 21:43:33 +08:00
🎁 Sync 2026-05-29 21:08:02
This commit is contained in:
1 parent
0f451257f1
commit
e35ce17f60
10 files changed
+113
-27
No files matched your search
@@ -44,8 +44,8 @@ function gen_outbound(flag, node, tag, proxy_table)
|
||||
local run_socks_instance = true
|
||||
if proxy_table ~= nil and type(proxy_table) == "table" then
|
||||
proxy_tag = proxy_table.tag or nil
|
||||
fragment = proxy_table.fragment or nil
|
||||
noise = proxy_table.noise or nil
|
||||
fragment = (proxy_table.fragment and not node.hysteria2_realms) and true or nil
|
||||
noise = (proxy_table.noise and not node.hysteria2_realms) and true or nil
|
||||
run_socks_instance = proxy_table.run_socks_instance
|
||||
end
|
||||
|
||||
@@ -274,14 +274,35 @@ function gen_outbound(flag, node, tag, proxy_table)
|
||||
udp[#udp+1] = c
|
||||
finalmask.udp = udp
|
||||
elseif TP == "hysteria" then
|
||||
local udp = {}
|
||||
if node.hysteria2_obfs_type and node.hysteria2_obfs_type ~= "" then
|
||||
finalmask.udp = {{
|
||||
local o = {
|
||||
type = node.hysteria2_obfs_type,
|
||||
settings = node.hysteria2_obfs_password and {
|
||||
password = node.hysteria2_obfs_password
|
||||
} or nil
|
||||
}}
|
||||
}
|
||||
udp[#udp+1] = o
|
||||
end
|
||||
if node.hysteria2_realms then
|
||||
local realm = api.parse_realm_uri(node.hysteria2_realm_url)
|
||||
local url, stun
|
||||
if realm then
|
||||
if realm.token and realm.server_url and realm.realm_id then
|
||||
url = "realm://" .. realm.token .. "@" .. realm.server_url .. "/" .. realm.realm_id
|
||||
end
|
||||
stun = realm.stun_servers or node.hysteria2_realm_stun
|
||||
end
|
||||
local r = {
|
||||
type = "realm",
|
||||
settings = {
|
||||
url = url,
|
||||
stunServers = stun
|
||||
}
|
||||
}
|
||||
udp[#udp+1] = r
|
||||
end
|
||||
finalmask.udp = udp
|
||||
local up = tonumber(node.hysteria2_up_mbps) or 0
|
||||
local down = tonumber(node.hysteria2_down_mbps) or 0
|
||||
finalmask.quicParams = {
|
||||
@@ -704,14 +725,35 @@ function gen_config_server(node)
|
||||
udp[#udp+1] = c
|
||||
finalmask.udp = udp
|
||||
elseif node.transport == "hysteria" then
|
||||
local udp = {}
|
||||
if node.hysteria2_obfs_type and node.hysteria2_obfs_type ~= "" then
|
||||
finalmask.udp = {{
|
||||
local o = {
|
||||
type = node.hysteria2_obfs_type,
|
||||
settings = node.hysteria2_obfs_password and {
|
||||
password = node.hysteria2_obfs_password
|
||||
} or nil
|
||||
}}
|
||||
}
|
||||
udp[#udp+1] = o
|
||||
end
|
||||
if node.hysteria2_realms then
|
||||
local realm = api.parse_realm_uri(node.hysteria2_realm_url)
|
||||
local url, stun
|
||||
if realm then
|
||||
if realm.token and realm.server_url and realm.realm_id then
|
||||
url = "realm://" .. realm.token .. "@" .. realm.server_url .. "/" .. realm.realm_id
|
||||
end
|
||||
stun = realm.stun_servers or node.hysteria2_realm_stun
|
||||
end
|
||||
local r = {
|
||||
type = "realm",
|
||||
settings = {
|
||||
url = url,
|
||||
stunServers = stun
|
||||
}
|
||||
}
|
||||
udp[#udp+1] = r
|
||||
end
|
||||
finalmask.udp = udp
|
||||
local ignore = tonumber(node.hysteria2_ignore_client_bandwidth) == 1
|
||||
local up = (not ignore) and tonumber(node.hysteria2_up_mbps) or 0
|
||||
local down = (not ignore) and tonumber(node.hysteria2_down_mbps) or 0
|
||||
@@ -742,7 +784,7 @@ function gen_config_server(node)
|
||||
}
|
||||
|
||||
local alpn = {}
|
||||
if node.alpn then
|
||||
if node.alpn and node.alpn ~= "default" then
|
||||
string.gsub(node.alpn, '[^' .. "," .. ']+', function(w)
|
||||
table.insert(alpn, w)
|
||||
end)
|
||||
|
||||
Reference in new issue
Block a user