MCPcopy
hub / github.com/tailscale/tailscale / SetNetInfo

Method SetNetInfo

control/controlclient/direct.go:502–515  ·  view source on GitHub ↗

SetNetInfo clones the provided NetInfo and remembers it for the next update. It reports whether the NetInfo has changed.

(ni *tailcfg.NetInfo)

Source from the content-addressed store, hash-verified

500// SetNetInfo clones the provided NetInfo and remembers it for the
501// next update. It reports whether the NetInfo has changed.
502func (c *Direct) SetNetInfo(ni *tailcfg.NetInfo) bool {
503 if ni == nil {
504 panic("nil NetInfo")
505 }
506 c.mu.Lock()
507 defer c.mu.Unlock()
508
509 if reflect.DeepEqual(ni, c.netinfo) {
510 return false
511 }
512 c.netinfo = ni.Clone()
513 c.logf("NetInfo: %v", ni)
514 return true
515}
516
517// SetTKAHead stores a new TKA head value for next update.
518// It reports whether the TKA head changed.

Callers 2

TestNewDirectFunction · 0.95
NewDirectFunction · 0.95

Calls 4

LockMethod · 0.65
UnlockMethod · 0.65
CloneMethod · 0.65
logfMethod · 0.45

Tested by 1

TestNewDirectFunction · 0.76