mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-11 21:27:31 +00:00
wgengine: remove SetNetInfoCallback method from Engine
LocalBackend can talk to magicsock on its own to do this without the "Engine" being involved. (Continuing a little side quest of cleaning up the Engine interface...) Updates #cleanup Change-Id: I8654acdca2b883b1bd557fdc0cfb90cd3a418a62 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:

committed by
Brad Fitzpatrick

parent
ad4c11aca1
commit
727b1432a8
@@ -657,7 +657,7 @@ func (c *Conn) updateNetInfo(ctx context.Context) (*netcheck.Report, error) {
|
||||
return report, nil
|
||||
}
|
||||
|
||||
// callNetInfoCallback calls the NetInfo callback (if previously
|
||||
// callNetInfoCallback calls the callback (if previously
|
||||
// registered with SetNetInfoCallback) if ni has substantially changed
|
||||
// since the last state.
|
||||
//
|
||||
@@ -691,6 +691,13 @@ func (c *Conn) addValidDiscoPathForTest(nodeKey key.NodePublic, addr netip.AddrP
|
||||
c.peerMap.setNodeKeyForIPPort(addr, nodeKey)
|
||||
}
|
||||
|
||||
// SetNetInfoCallback sets the func to be called whenever the network conditions
|
||||
// change.
|
||||
//
|
||||
// At most one func can be registered; the most recent one replaces any previous
|
||||
// registration.
|
||||
//
|
||||
// This is called by LocalBackend.
|
||||
func (c *Conn) SetNetInfoCallback(fn func(*tailcfg.NetInfo)) {
|
||||
if fn == nil {
|
||||
panic("nil NetInfoCallback")
|
||||
|
Reference in New Issue
Block a user