mirror of
https://github.com/caiwx86/small-packages.git
synced 2026-11-02 19:13:56 +08:00
update 2026-09-02 23:49:44
This commit is contained in:
1 parent
86b8972e8e
commit
beae9d285e
1991 files changed
+1523711
-147
No files matched your search
@@ -597,6 +597,7 @@ function gen_outbound(flag, node, tag, proxy_table)
|
||||
realm.address = nil
|
||||
realm.port = nil
|
||||
realm.port_mapping = (node.hysteria2_realm_upnp == "1") and { enabled = true } or nil
|
||||
realm.http_client = "direct_http_client"
|
||||
return realm
|
||||
end
|
||||
return nil
|
||||
@@ -645,6 +646,19 @@ function gen_outbound(flag, node, tag, proxy_table)
|
||||
}
|
||||
end
|
||||
|
||||
if node.protocol == "snell" then
|
||||
protocol_table = {
|
||||
version = tonumber(node.snell_version),
|
||||
psk = node.snell_psk,
|
||||
userkey = node.password,
|
||||
reuse = node.snell_reuse == "1" and true or false,
|
||||
network = node.snell_network,
|
||||
obfs_mode = node.snell_version == "4" and node.snell_obfs_mode or nil,
|
||||
obfs_host = node.snell_version == "4" and node.snell_obfs_host or nil,
|
||||
mode = node.snell_version == "6" and node.snell_mode or nil,
|
||||
}
|
||||
end
|
||||
|
||||
if protocol_table then
|
||||
for key, value in pairs(protocol_table) do
|
||||
result[key] = value
|
||||
@@ -801,6 +815,10 @@ function gen_config_server(node)
|
||||
u.allowed_ips = user.allowed_ips or {}
|
||||
u.persistent_keepalive_interval = 0
|
||||
end
|
||||
if node.protocol == "snell" then
|
||||
u.name = user.username
|
||||
u.userkey = user.password
|
||||
end
|
||||
users[#users + 1] = u
|
||||
end
|
||||
end
|
||||
@@ -953,6 +971,7 @@ function gen_config_server(node)
|
||||
realm.port = nil
|
||||
realm.stun_domain_resolver = "direct"
|
||||
realm.port_mapping = (node.hysteria2_realm_upnp == "1") and { enabled = true } or nil
|
||||
realm.http_client = { detour = "direct" }
|
||||
return realm
|
||||
end
|
||||
return nil
|
||||
@@ -981,6 +1000,16 @@ function gen_config_server(node)
|
||||
end
|
||||
end
|
||||
|
||||
if node.protocol == "snell" then
|
||||
protocol_table = {
|
||||
users = users,
|
||||
version = tonumber(node.snell_version),
|
||||
psk = node.snell_psk,
|
||||
obfs_mode = node.snell_version == "5" and node.snell_obfs_mode or nil,
|
||||
mode = node.snell_version == "6" and node.snell_mode or nil,
|
||||
}
|
||||
end
|
||||
|
||||
if node.protocol == "direct" then
|
||||
protocol_table = {
|
||||
network = (node.d_protocol ~= "TCP,UDP") and node.d_protocol or nil,
|
||||
@@ -1167,8 +1196,8 @@ function gen_config(var)
|
||||
format = format,
|
||||
path = _type == "local" and w or nil,
|
||||
url = _type == "remote" and w or nil,
|
||||
--download_detour = _type == "remote" and "",
|
||||
--update_interval = _type == "remote" and "",
|
||||
http_client = _type == "remote" and "remote_http_client" or nil,
|
||||
--update_interval = _type == "remote" and "1d" or nil,
|
||||
}
|
||||
end
|
||||
end
|
||||
@@ -1621,7 +1650,7 @@ function gen_config(var)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local rule = {
|
||||
action = "route",
|
||||
inbound = inboundTag,
|
||||
@@ -2202,7 +2231,37 @@ function gen_config(var)
|
||||
table.insert(route.rule_set, v)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local http_clients
|
||||
if outbounds then
|
||||
local proxy_tag = COMMON.default_outbound_tag
|
||||
if proxy_tag == "block" or proxy_tag == "direct" then -- 如默认节点是特殊节点,则选一个可用节点作为出口(urltest优先)
|
||||
local first_node
|
||||
for _, v in ipairs(outbounds) do
|
||||
if not v["_flag_proxy_tag"] and not v.detour and v["_id"] and ((v.server and (v.server_port or v.server_ports)) or v.type == "urltest") then
|
||||
first_node = first_node or v.tag
|
||||
if v.type == "urltest" then
|
||||
proxy_tag = v.tag
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
if proxy_tag == COMMON.default_outbound_tag then
|
||||
proxy_tag = first_node
|
||||
end
|
||||
end
|
||||
http_clients = {
|
||||
{
|
||||
tag = "remote_http_client",
|
||||
detour = proxy_tag
|
||||
},
|
||||
{
|
||||
tag = "direct_http_client",
|
||||
detour = "direct"
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
if inbounds or outbounds then
|
||||
local config = {
|
||||
log = {
|
||||
@@ -2219,8 +2278,10 @@ function gen_config(var)
|
||||
outbounds = outbounds,
|
||||
-- 路由
|
||||
route = route,
|
||||
--实验性
|
||||
-- 实验性
|
||||
experimental = experimental,
|
||||
-- HTTP Client
|
||||
http_clients = http_clients
|
||||
}
|
||||
table.insert(outbounds, {
|
||||
type = "direct",
|
||||
@@ -2349,7 +2410,7 @@ function gen_proto_config(var)
|
||||
}
|
||||
if outbound then table.insert(outbounds, outbound) end
|
||||
end
|
||||
|
||||
|
||||
local config = {
|
||||
log = {
|
||||
disabled = true,
|
||||
|
||||
Reference in new issue
Block a user