From 8c3a98faa236d1f6e9daeb48fcb9e7f86f9fd4c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Thu, 5 Dec 2024 17:40:15 +0800 Subject: [PATCH] wireguard: Fix set reserved --- outbound/wireguard.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/outbound/wireguard.go b/outbound/wireguard.go index 3ae3f63b..62876849 100644 --- a/outbound/wireguard.go +++ b/outbound/wireguard.go @@ -152,6 +152,13 @@ func (w *WireGuard) start() error { } bind = wireguard.NewClientBind(w.ctx, w, w.listener, isConnect, connectAddr, reserved) } + if w.useStdNetBind || len(w.peers) > 1 { + for _, peer := range w.peers { + if peer.Reserved != [3]uint8{} { + bind.SetReservedForEndpoint(peer.Endpoint, peer.Reserved) + } + } + } err = w.tunDevice.Start() if err != nil { return err