Skip to content

Commit 8be36fa

Browse files
committed
set endpoint when adding/updating peer
1 parent 9f9e80a commit 8be36fa

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

internal/agent/interface.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"log/slog"
88
"net"
99
"slices"
10+
"strconv"
1011
"time"
1112

1213
"github.com/devilcove/boltdb"
@@ -372,8 +373,13 @@ func convertPeerToWG(netPeer plexus.NetworkPeer, peers []plexus.NetworkPeer) (wg
372373
if err != nil {
373374
return wgtypes.PeerConfig{}, err
374375
}
376+
addr, err := net.ResolveUDPAddr("udp", netPeer.Endpoint.String()+":"+strconv.Itoa(netPeer.PublicListenPort))
377+
if err != nil {
378+
return wgtypes.PeerConfig{}, err
379+
}
375380
return wgtypes.PeerConfig{
376381
PublicKey: key,
382+
Endpoint: addr,
377383
PersistentKeepaliveInterval: &keepalive,
378384
ReplaceAllowedIPs: true,
379385
AllowedIPs: getAllowedIPs(netPeer, peers),

0 commit comments

Comments
 (0)