mirror of
https://github.com/caiwx86/small-packages.git
synced 2026-10-31 02:05:13 +08:00
update 2026-07-12 21:07:28
This commit is contained in:
1 parent
24c2eb6e4f
commit
192d5e4fd9
41 files changed
+779
-611
No files matched your search
@@ -327,8 +327,6 @@ function gen_outbound(flag, node, tag, proxy_table)
|
||||
headers = node.user_agent and {
|
||||
["User-Agent"] = node.user_agent
|
||||
} or nil,
|
||||
idle_timeout = (node.http_h2_health_check == "1") and node.http_h2_read_idle_timeout or nil,
|
||||
ping_timeout = (node.http_h2_health_check == "1") and node.http_h2_health_check_timeout or nil,
|
||||
}
|
||||
-- TLS is not enforced. If TLS is not configured, plain HTTP 1.1 will be used.
|
||||
end
|
||||
@@ -341,8 +339,8 @@ function gen_outbound(flag, node, tag, proxy_table)
|
||||
headers = node.user_agent and {
|
||||
["User-Agent"] = node.user_agent
|
||||
} or nil,
|
||||
idle_timeout = (node.http_h2_health_check == "1") and node.http_h2_read_idle_timeout or nil,
|
||||
ping_timeout = (node.http_h2_health_check == "1") and node.http_h2_health_check_timeout or nil,
|
||||
idle_timeout = (node.http_h2_health_check == "1") and api.format_go_time(node.http_h2_read_idle_timeout, "15s") or nil,
|
||||
ping_timeout = (node.http_h2_health_check == "1") and api.format_go_time(node.http_h2_health_check_timeout, "15s") or nil,
|
||||
}
|
||||
-- TLS is not enforced. If TLS is not configured, plain HTTP 1.1 will be used.
|
||||
end
|
||||
@@ -382,8 +380,8 @@ function gen_outbound(flag, node, tag, proxy_table)
|
||||
v2ray_transport = {
|
||||
type = "grpc",
|
||||
service_name = node.grpc_serviceName,
|
||||
idle_timeout = tonumber(node.grpc_idle_timeout) or nil,
|
||||
ping_timeout = tonumber(node.grpc_health_check_timeout) or nil,
|
||||
idle_timeout = (node.grpc_health_check == "1") and api.format_go_time(node.grpc_idle_timeout, "15s") or nil,
|
||||
ping_timeout = (node.grpc_health_check == "1") and api.format_go_time(node.grpc_health_check_timeout, "15s") or nil,
|
||||
permit_without_stream = (node.grpc_permit_without_stream == "1") and true or nil,
|
||||
}
|
||||
end
|
||||
@@ -595,20 +593,34 @@ function gen_outbound(flag, node, tag, proxy_table)
|
||||
hop_interval_max = interval_max,
|
||||
up_mbps = (node.hysteria2_up_mbps and tonumber(node.hysteria2_up_mbps)) and tonumber(node.hysteria2_up_mbps) or nil,
|
||||
down_mbps = (node.hysteria2_down_mbps and tonumber(node.hysteria2_down_mbps)) and tonumber(node.hysteria2_down_mbps) or nil,
|
||||
obfs = node.hysteria2_obfs_type and {
|
||||
type = node.hysteria2_obfs_type,
|
||||
password = node.hysteria2_obfs_password
|
||||
} or nil,
|
||||
obfs = (function(t)
|
||||
if not t or t == "" then return nil end
|
||||
local o = {
|
||||
type = t,
|
||||
password = node.hysteria2_obfs_password
|
||||
}
|
||||
if t == "gecko" then
|
||||
local min = tonumber(node.hysteria2_obfs_MinPacketSize) or 512
|
||||
local max = tonumber(node.hysteria2_obfs_MaxPacketSize) or 1200
|
||||
if min <= 0 or min > max or max > 2048 then
|
||||
min = 512
|
||||
max = 1200
|
||||
end
|
||||
o.min_packet_size = min
|
||||
o.max_packet_size = max
|
||||
end
|
||||
return o
|
||||
end)(node.hysteria2_obfs_type),
|
||||
password = node.hysteria2_auth_password or nil,
|
||||
idle_timeout = (function(t)
|
||||
if not version_ge_1_14_0 then return nil end
|
||||
t = tonumber(tostring(t or "30"):match("^%d+"))
|
||||
return (t and t >= 4 and t <= 120) and t or 30
|
||||
return (t and t >= 4 and t <= 120) and t .. "s" or "30s"
|
||||
end)(node.hysteria2_idle_timeout),
|
||||
keep_alive_period = (function(t)
|
||||
if not version_ge_1_14_0 then return nil end
|
||||
t = tonumber(tostring(t or "0"):match("^%d+"))
|
||||
return (t and t >= 2 and t <= 60) and t or nil
|
||||
return (t and t >= 2 and t <= 60) and t .. "s" or nil
|
||||
end)(node.hysteria2_keep_alive_period),
|
||||
disable_path_mtu_discovery = version_ge_1_14_0 and (tonumber(node.hysteria2_disable_mtu_discovery) == 1) or nil,
|
||||
tls = tls,
|
||||
@@ -620,6 +632,8 @@ function gen_outbound(flag, node, tag, proxy_table)
|
||||
realm.server_url = (realm.scheme == "realm+http" and "http://" or "https://") .. realm.server_url
|
||||
realm.stun_servers = realm.stun_servers or node.hysteria2_realm_stun
|
||||
realm.scheme = nil
|
||||
realm.address = nil
|
||||
realm.port = nil
|
||||
return realm
|
||||
end
|
||||
return nil
|
||||
@@ -945,10 +959,24 @@ function gen_config_server(node)
|
||||
protocol_table = {
|
||||
up_mbps = (node.hysteria2_ignore_client_bandwidth ~= "1" and node.hysteria2_up_mbps and tonumber(node.hysteria2_up_mbps)) and tonumber(node.hysteria2_up_mbps) or nil,
|
||||
down_mbps = (node.hysteria2_ignore_client_bandwidth ~= "1" and node.hysteria2_down_mbps and tonumber(node.hysteria2_down_mbps)) and tonumber(node.hysteria2_down_mbps) or nil,
|
||||
obfs = node.hysteria2_obfs_type and {
|
||||
type = node.hysteria2_obfs_type,
|
||||
password = node.hysteria2_obfs_password
|
||||
} or nil,
|
||||
obfs = (function(t)
|
||||
if not t or t == "" then return nil end
|
||||
local o = {
|
||||
type = t,
|
||||
password = node.hysteria2_obfs_password
|
||||
}
|
||||
if t == "gecko" then
|
||||
local min = tonumber(node.hysteria2_obfs_MinPacketSize) or 512
|
||||
local max = tonumber(node.hysteria2_obfs_MaxPacketSize) or 1200
|
||||
if min <= 0 or min > max or max > 2048 then
|
||||
min = 512
|
||||
max = 1200
|
||||
end
|
||||
o.min_packet_size = min
|
||||
o.max_packet_size = max
|
||||
end
|
||||
return o
|
||||
end)(node.hysteria2_obfs_type),
|
||||
users = {
|
||||
{
|
||||
name = "user1",
|
||||
@@ -963,6 +991,8 @@ function gen_config_server(node)
|
||||
realm.server_url = (realm.scheme == "realm+http" and "http://" or "https://") .. realm.server_url
|
||||
realm.stun_servers = realm.stun_servers or node.hysteria2_realm_stun
|
||||
realm.scheme = nil
|
||||
realm.address = nil
|
||||
realm.port = nil
|
||||
realm.stun_domain_resolver = "direct"
|
||||
return realm
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user