mirror of
https://github.com/tailscale/tailscale.git
synced 2025-10-15 10:49:18 +00:00
control/controlclient, types/netmap: start plumbing delta netmap updates
Currently only the top four most popular changes: endpoints, DERP home, online, and LastSeen. Updates #1909 Change-Id: I03152da176b2b95232b56acabfb55dcdfaa16b79 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:

committed by
Brad Fitzpatrick

parent
c0ade132e6
commit
3af051ea27
@@ -2588,6 +2588,29 @@ func simpleDur(d time.Duration) time.Duration {
|
||||
return d.Round(time.Minute)
|
||||
}
|
||||
|
||||
// UpdateNetmapDelta implements controlclient.NetmapDeltaUpdater.
|
||||
func (c *Conn) UpdateNetmapDelta(muts []netmap.NodeMutation) (handled bool) {
|
||||
c.mu.Lock()
|
||||
defer c.mu.Unlock()
|
||||
|
||||
for _, m := range muts {
|
||||
nodeID := m.NodeIDBeingMutated()
|
||||
ep, ok := c.peerMap.endpointForNodeID(nodeID)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
switch m := m.(type) {
|
||||
case netmap.NodeMutationDERPHome:
|
||||
ep.setDERPHome(uint16(m.DERPRegion))
|
||||
case netmap.NodeMutationEndpoints:
|
||||
ep.mu.Lock()
|
||||
ep.setEndpointsLocked(views.SliceOf(m.Endpoints))
|
||||
ep.mu.Unlock()
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// UpdateStatus implements the interface nede by ipnstate.StatusBuilder.
|
||||
//
|
||||
// This method adds in the magicsock-specific information only. Most
|
||||
|
Reference in New Issue
Block a user