From 5295e3e1195e77821feb11537ba40bb0a49124ae Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Thu, 21 May 2026 21:35:13 +0000 Subject: [PATCH] ipn/{ipnstate,ipnlocal}: add integer NodeID to PeerStatus In aa5da2e5f22a we made the IPN bus include deltas, including the PeersRemoved, sending a slice of integer NodeIDs that were removed. But when updating xcode, I realized there was no way to map those integers to the stable node IDs used in other places. I was consdering changing the just-added ipn.Notify.PeersRemoved from an IntID to a string StableID, but then it doesn't match the MapResponse wire protocol, which we've tried to match so far. Instead, just add the integer ID as well. Callers can use whichever world they want, having both. It's a little regrettable that we still have two worlds of IDs, but oh well. Neither is really suitable to a hypothetical future fully federated world of control servers anyway, so we'll need a third type later anyway, so just live with the two we have for now. Updates #12542 Change-Id: Ib8fd48a265e1da1f8779152f141f624a7f7260e9 Signed-off-by: Brad Fitzpatrick --- ipn/ipnlocal/local.go | 1 + ipn/ipnstate/ipnstate.go | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/ipn/ipnlocal/local.go b/ipn/ipnlocal/local.go index e8f5154a1..b7a4691ba 100644 --- a/ipn/ipnlocal/local.go +++ b/ipn/ipnlocal/local.go @@ -1516,6 +1516,7 @@ func (b *LocalBackend) populatePeerStatusLocked(sb *ipnstate.StatusBuilder) { func peerStatusFromNode(ps *ipnstate.PeerStatus, n tailcfg.NodeView) { ps.PublicKey = n.Key() ps.ID = n.StableID() + ps.NodeID = n.ID() ps.Created = n.Created() ps.ExitNodeOption = buildfeatures.HasUseExitNode && tsaddr.ContainsExitRoutes(n.AllowedIPs()) if n.Tags().Len() != 0 { diff --git a/ipn/ipnstate/ipnstate.go b/ipn/ipnstate/ipnstate.go index f7df7e5a2..f0b9dcc82 100644 --- a/ipn/ipnstate/ipnstate.go +++ b/ipn/ipnstate/ipnstate.go @@ -223,6 +223,7 @@ type PeerStatusLite struct { // inconsistencies or lost data in the peer status. type PeerStatus struct { ID tailcfg.StableNodeID + NodeID tailcfg.NodeID PublicKey key.NodePublic HostName string // HostInfo's Hostname (not a DNS name or necessarily unique) @@ -443,6 +444,9 @@ func (sb *StatusBuilder) AddPeer(peer key.NodePublic, st *PeerStatus) { if v := st.ID; v != "" { e.ID = v } + if v := st.NodeID; v != 0 { + e.NodeID = v + } if v := st.HostName; v != "" { e.HostName = v }