SetNetInfo clones the provided NetInfo and remembers it for the next update. It reports whether the NetInfo has changed.
(ni *tailcfg.NetInfo)
| 500 | // SetNetInfo clones the provided NetInfo and remembers it for the |
| 501 | // next update. It reports whether the NetInfo has changed. |
| 502 | func (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. |