Skip to content

Commit

Permalink
set endpoint when adding/updating peer
Browse files Browse the repository at this point in the history
  • Loading branch information
mattkasun committed Apr 22, 2024
1 parent 9f9e80a commit 8be36fa
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions internal/agent/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"log/slog"
"net"
"slices"
"strconv"
"time"

"github.com/devilcove/boltdb"
Expand Down Expand Up @@ -372,8 +373,13 @@ func convertPeerToWG(netPeer plexus.NetworkPeer, peers []plexus.NetworkPeer) (wg
if err != nil {
return wgtypes.PeerConfig{}, err
}
addr, err := net.ResolveUDPAddr("udp", netPeer.Endpoint.String()+":"+strconv.Itoa(netPeer.PublicListenPort))
if err != nil {
return wgtypes.PeerConfig{}, err
}
return wgtypes.PeerConfig{
PublicKey: key,
Endpoint: addr,
PersistentKeepaliveInterval: &keepalive,
ReplaceAllowedIPs: true,
AllowedIPs: getAllowedIPs(netPeer, peers),
Expand Down

0 comments on commit 8be36fa

Please sign in to comment.