@@ -231,7 +231,7 @@ func (c *configMaps) peerConfigLocked() []*tailcfg.Node {
231
231
return out
232
232
}
233
233
234
- func (c * configMaps ) setTunnelDestinaion (id uuid.UUID ) {
234
+ func (c * configMaps ) setTunnelDestination (id uuid.UUID ) {
235
235
c .L .Lock ()
236
236
defer c .L .Unlock ()
237
237
lc , ok := c .peers [id ]
@@ -542,10 +542,12 @@ func (c *configMaps) peerLostTimeout(id uuid.UUID) {
542
542
"timeout triggered for peer that is removed from the map" )
543
543
return
544
544
}
545
- if peerStatus , ok := status .Peer [lc .node .Key ]; ok {
546
- lc .lastHandshake = peerStatus .LastHandshake
545
+ if lc .node != nil {
546
+ if peerStatus , ok := status .Peer [lc .node .Key ]; ok {
547
+ lc .lastHandshake = peerStatus .LastHandshake
548
+ }
549
+ logger = logger .With (slog .F ("key_id" , lc .node .Key .ShortString ()))
547
550
}
548
- logger = logger .With (slog .F ("key_id" , lc .node .Key .ShortString ()))
549
551
if ! lc .lost {
550
552
logger .Debug (context .Background (),
551
553
"timeout triggered for peer that is no longer lost" )
@@ -588,7 +590,7 @@ func (c *configMaps) nodeAddresses(publicKey key.NodePublic) ([]netip.Prefix, bo
588
590
c .L .Lock ()
589
591
defer c .L .Unlock ()
590
592
for _ , lc := range c .peers {
591
- if lc .node .Key == publicKey {
593
+ if lc .node != nil && lc . node .Key == publicKey {
592
594
return lc .node .Addresses , true
593
595
}
594
596
}
@@ -608,12 +610,16 @@ func (c *configMaps) fillPeerDiagnostics(d *PeerDiagnostics, peerID uuid.UUID) {
608
610
if ! ok {
609
611
return
610
612
}
613
+
611
614
d .ReceivedNode = lc .node
612
- ps , ok := status .Peer [lc .node .Key ]
613
- if ! ok {
614
- return
615
+ if lc .node != nil {
616
+ ps , ok := status .Peer [lc .node .Key ]
617
+ if ! ok {
618
+ return
619
+ }
620
+ d .LastWireguardHandshake = ps .LastHandshake
615
621
}
616
- d . LastWireguardHandshake = ps . LastHandshake
622
+ return
617
623
}
618
624
619
625
func (c * configMaps ) peerReadyForHandshakeTimeout (peerID uuid.UUID ) {
@@ -638,9 +644,9 @@ type peerLifecycle struct {
638
644
peerID uuid.UUID
639
645
// isDestination specifies if the peer is a destination, meaning we
640
646
// initiated a tunnel to the peer. When the peer is a destination, we do not
641
- // respond to node updates with READY_FOR_HANDSHAKEs , and we wait to program
642
- // the peer into wireguard until we receive a READY_FOR_HANDSHAKE from the
643
- // peer or the timeout is reached.
647
+ // respond to node updates with `READY_FOR_HANDSHAKE`s , and we wait to
648
+ // program the peer into wireguard until we receive a READY_FOR_HANDSHAKE
649
+ // from the peer or the timeout is reached.
644
650
isDestination bool
645
651
// node is the tailcfg.Node for the peer. It may be nil until we receive a
646
652
// NODE update for it.
0 commit comments