mirror of
https://github.com/juanfont/headscale.git
synced 2026-10-04 05:43:37 +09:00
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
0.29 pins an older tailscale where Hostinfo.NetInfo.PreferredDERP is an int,
so the DERPRegionID types are int here.
(cherry picked from commit 59f3ff12a7)
This commit is contained in:
@@ -675,9 +675,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
|
||||
|
||||
Reference in New Issue
Block a user