@@ -72,9 +72,13 @@ function wireguard()
7272 {
7373 publicKey = server .peer_pubkey ,
7474 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 ,
7678 }
7779 },
80+ kernelMode = (server .kernelmode == " 1" ) and true or false ,
81+ reserved = {server .reserved } or nil ,
7882 mtu = tonumber (server .mtu )
7983 }
8084end
@@ -172,7 +176,7 @@ local Xray = {
172176 protocol = server .v2ray_protocol ,
173177 settings = outbound_settings ,
174178 -- 底层传输配置
175- streamSettings = {
179+ streamSettings = ( server . v2ray_protocol ~= " wireguard " ) and {
176180 network = server .transport or " tcp" ,
177181 security = (server .tls == ' 1' ) and " tls" or (server .reality == ' 1' ) and " reality" or nil ,
178182 tlsSettings = (server .tls == ' 1' ) and {
@@ -258,14 +262,14 @@ local Xray = {
258262 tcpNoDelay = (server .mptcp == " 1" ) and true or false , -- MPTCP
259263 tcpcongestion = server .custom_tcpcongestion -- 连接服务器节点的 TCP 拥塞控制算法
260264 }
261- },
262- mux = {
265+ } or nil ,
266+ mux = ( server . v2ray_protocol ~= " wireguard " ) and {
263267 -- mux
264268 enabled = (server .mux == " 1" ) and true or false , -- Mux
265269 concurrency = tonumber (server .concurrency ), -- TCP 最大并发连接数
266270 xudpConcurrency = tonumber (server .xudpConcurrency ), -- UDP 最大并发连接数
267271 xudpProxyUDP443 = server .xudpProxyUDP443 -- 对被代理的 UDP/443 流量处理方式
268- }
272+ } or nil
269273 }
270274}
271275local 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 = {
322326}
323327local hysteria = {
324328 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 {
326330 up = tonumber (server .uplink_capacity ) and tonumber (server .uplink_capacity ) .. " mbps" or nil ,
327331 down = tonumber (server .downlink_capacity ) and tonumber (server .downlink_capacity ) .. " mbps" or nil
328332 },
@@ -336,12 +340,11 @@ local hysteria = {
336340 hopInterval = (server .port_range and (tonumber (server .hopinterval ) .. " s" ) or nil )
337341 } or nil )
338342 } or nil ,
339-
340343--[[
341344 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+ ]] --
345348 tcpRedirect = (proto :find (" tcp" ) and local_port ~= " 0" ) and {
346349 listen = " 0.0.0.0:" .. tonumber (local_port )
347350 } or nil ,
@@ -359,7 +362,7 @@ local hysteria = {
359362 maxConnReceiveWindow = (server .maxconnreceivewindow and server .maxconnreceivewindow or nil ),
360363 maxIdleTimeout = (tonumber (server .maxidletimeout ) and tonumber (server .maxidletimeout ) .. " s" or nil ),
361364 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
363366 } or nil ,
364367 auth = server .hy2_auth ,
365368 tls = (server .tls_host ) and {
@@ -394,7 +397,7 @@ local chain_sslocal = {
394397 mode = (proto :find (" tcp,udp" ) and " tcp_and_udp" ) or proto .. " _only" ,
395398 protocol = " redir" ,
396399 tcp_redir = " redirect" ,
397- -- tcp_redir = "tproxy",
400+ -- tcp_redir = "tproxy",
398401 udp_redir = " tproxy"
399402 },
400403 socks_port ~= " 0" and {
0 commit comments