@@ -72,9 +72,13 @@ function wireguard()
72
72
{
73
73
publicKey = server .peer_pubkey ,
74
74
preSharedKey = server .preshared_key ,
75
- endpoint = server .server .. " :" .. server .server_port
75
+ endpoint = server .server .. " :" .. server .server_port ,
76
+ keepAlive = tonumber (server .heartbeat ),
77
+ allowedIPs = (server .allowedips ) or nil ,
76
78
}
77
79
},
80
+ kernelMode = (server .kernelmode == " 1" ) and true or false ,
81
+ reserved = {server .reserved } or nil ,
78
82
mtu = tonumber (server .mtu )
79
83
}
80
84
end
@@ -172,7 +176,7 @@ local Xray = {
172
176
protocol = server .v2ray_protocol ,
173
177
settings = outbound_settings ,
174
178
-- 底层传输配置
175
- streamSettings = {
179
+ streamSettings = ( server . v2ray_protocol ~= " wireguard " ) and {
176
180
network = server .transport or " tcp" ,
177
181
security = (server .tls == ' 1' ) and " tls" or (server .reality == ' 1' ) and " reality" or nil ,
178
182
tlsSettings = (server .tls == ' 1' ) and {
@@ -258,14 +262,14 @@ local Xray = {
258
262
tcpNoDelay = (server .mptcp == " 1" ) and true or false , -- MPTCP
259
263
tcpcongestion = server .custom_tcpcongestion -- 连接服务器节点的 TCP 拥塞控制算法
260
264
}
261
- },
262
- mux = {
265
+ } or nil ,
266
+ mux = ( server . v2ray_protocol ~= " wireguard " ) and {
263
267
-- mux
264
268
enabled = (server .mux == " 1" ) and true or false , -- Mux
265
269
concurrency = tonumber (server .concurrency ), -- TCP 最大并发连接数
266
270
xudpConcurrency = tonumber (server .xudpConcurrency ), -- UDP 最大并发连接数
267
271
xudpProxyUDP443 = server .xudpProxyUDP443 -- 对被代理的 UDP/443 流量处理方式
268
- }
272
+ } or nil
269
273
}
270
274
}
271
275
local cipher = " ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA:AES128-SHA:AES256-SHA:DES-CBC3-SHA"
@@ -322,7 +326,7 @@ local ss = {
322
326
}
323
327
local hysteria = {
324
328
server = (server .server_port and (server .port_range and (server .server .. " :" .. server .server_port .. " ," .. server .port_range ) or server .server .. " :" .. server .server_port ) or (server .port_range and server .server .. " :" .. server .port_range or server .server .. " :443" )),
325
- bandwidth = {
329
+ bandwidth = ( server . uplink_capacity or server . downlink_capacity ) and {
326
330
up = tonumber (server .uplink_capacity ) and tonumber (server .uplink_capacity ) .. " mbps" or nil ,
327
331
down = tonumber (server .downlink_capacity ) and tonumber (server .downlink_capacity ) .. " mbps" or nil
328
332
},
@@ -336,12 +340,11 @@ local hysteria = {
336
340
hopInterval = (server .port_range and (tonumber (server .hopinterval ) .. " s" ) or nil )
337
341
} or nil )
338
342
} or nil ,
339
-
340
343
--[[
341
344
tcpTProxy = (proto:find("tcp") and local_port ~= "0") and {
342
- listen = "0.0.0.0:" .. tonumber(local_port)
343
- } or nil,
344
- ]]
345
+ listen = "0.0.0.0:" .. tonumber(local_port)
346
+ } or nil,
347
+ ]] --
345
348
tcpRedirect = (proto :find (" tcp" ) and local_port ~= " 0" ) and {
346
349
listen = " 0.0.0.0:" .. tonumber (local_port )
347
350
} or nil ,
@@ -359,7 +362,7 @@ local hysteria = {
359
362
maxConnReceiveWindow = (server .maxconnreceivewindow and server .maxconnreceivewindow or nil ),
360
363
maxIdleTimeout = (tonumber (server .maxidletimeout ) and tonumber (server .maxidletimeout ) .. " s" or nil ),
361
364
keepAlivePeriod = (tonumber (server .keepaliveperiod ) and tonumber (server .keepaliveperiod ) .. " s" or nil ),
362
- disable_mtu_discovery = (server .disablepathmtudiscovery == " 1" ) and true or false
365
+ disablePathMTUDiscovery = (server .disablepathmtudiscovery == " 1" ) and true or false
363
366
} or nil ,
364
367
auth = server .hy2_auth ,
365
368
tls = (server .tls_host ) and {
@@ -394,7 +397,7 @@ local chain_sslocal = {
394
397
mode = (proto :find (" tcp,udp" ) and " tcp_and_udp" ) or proto .. " _only" ,
395
398
protocol = " redir" ,
396
399
tcp_redir = " redirect" ,
397
- -- tcp_redir = "tproxy",
400
+ -- tcp_redir = "tproxy",
398
401
udp_redir = " tproxy"
399
402
},
400
403
socks_port ~= " 0" and {
0 commit comments