mirror of
https://github.com/caiwx86/small-packages.git
synced 2026-11-01 16:44:45 +08:00
update 2026-08-15 04:24:58
This commit is contained in:
1 parent
a59171002f
commit
c9ba9e3a54
1983 files changed
+619
-1523517
No files matched your search
@@ -683,6 +683,8 @@ function gen_outbound(flag, node, tag, proxy_table)
|
||||
end
|
||||
|
||||
function gen_config_server(node)
|
||||
local endpoints = {}
|
||||
local inbounds = {}
|
||||
local outbounds = {
|
||||
{ type = "direct", tag = "direct" }
|
||||
}
|
||||
@@ -825,6 +827,12 @@ function gen_config_server(node)
|
||||
u.name = user.username
|
||||
u.password = user.password
|
||||
end
|
||||
if node.protocol == "wireguard" then
|
||||
u.public_key = user.wireguard_public_key
|
||||
u.pre_shared_key = user.wireguard_pre_shared_key
|
||||
u.allowed_ips = user.allowed_ips or {}
|
||||
u.persistent_keepalive_interval = 0
|
||||
end
|
||||
users[#users + 1] = u
|
||||
end
|
||||
end
|
||||
@@ -992,6 +1000,18 @@ function gen_config_server(node)
|
||||
end
|
||||
end
|
||||
|
||||
if node.protocol == "wireguard" then
|
||||
inbound.listen = nil
|
||||
inbound.system = node.wireguard_system_interface == "1" and true or false
|
||||
inbound.name = "sbwg_" .. node[".name"]
|
||||
inbound.mtu = tonumber(node.wireguard_mtu or 1408)
|
||||
inbound.address = node.wireguard_local_address
|
||||
inbound.private_key = node.wireguard_private_key
|
||||
if users then
|
||||
inbound.peers = users
|
||||
end
|
||||
end
|
||||
|
||||
if node.protocol == "direct" then
|
||||
protocol_table = {
|
||||
network = (node.d_protocol ~= "TCP,UDP") and node.d_protocol or nil,
|
||||
@@ -1006,6 +1026,13 @@ function gen_config_server(node)
|
||||
end
|
||||
end
|
||||
|
||||
if node.protocol == "wireguard" then
|
||||
inbound.listen = nil
|
||||
table.insert(endpoints, inbound)
|
||||
else
|
||||
table.insert(inbounds, inbound)
|
||||
end
|
||||
|
||||
local route = {
|
||||
rules = {
|
||||
{
|
||||
@@ -1061,7 +1088,8 @@ function gen_config_server(node)
|
||||
}
|
||||
}
|
||||
},
|
||||
inbounds = { inbound },
|
||||
endpoints = endpoints,
|
||||
inbounds = inbounds,
|
||||
outbounds = outbounds,
|
||||
route = route
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user