state: classify map requests before broadcasting

Each request is reduced to the narrowest change it justifies, so a
keepalive or endpoint bump no longer resends the whole node to peers.

Updates #3417
This commit is contained in:
Kristoffer Dalby
2026-09-09 14:45:32 +00:00
parent 286f1d5a12
commit 59f3ff12a7
6 changed files with 1239 additions and 215 deletions
+2 -3
View File
@@ -623,9 +623,8 @@ func (node *Node) MarshalZerologObject(e *zerolog.Event) {
// PeerChangeFromMapRequest takes a [tailcfg.MapRequest] and compares it to the node
// to produce a [tailcfg.PeerChange] struct that can be used to updated the node and
// inform peers about smaller changes to the node.
// When a field is added to this function, remember to also add it to:
// - [Node.ApplyPeerChange]
// - logTracePeerChange in poll.go.
// When a field is added to this function, also add it to
// [Node.ApplyPeerChange].
func (node *Node) PeerChangeFromMapRequest(req tailcfg.MapRequest) tailcfg.PeerChange {
ret := tailcfg.PeerChange{
NodeID: tailcfg.NodeID(node.ID), //nolint:gosec // NodeID is bounded