Update the telemetry store with the current self node state. Returns true if the home DERP has changed.
(n *tailcfg.Node)
| 187 | // Update the telemetry store with the current self node state. |
| 188 | // Returns true if the home DERP has changed. |
| 189 | func (b *TelemetryStore) updateByNodeLocked(n *tailcfg.Node) bool { |
| 190 | if n == nil { |
| 191 | return false |
| 192 | } |
| 193 | // #nosec G115 - Safe conversion as n.ID is expected to be within uint64 range for node IDs |
| 194 | b.nodeIDSelf = uint64(n.ID) |
| 195 | derpIP, err := netip.ParseAddrPort(n.DERP) |
| 196 | if err != nil { |
| 197 | return false |
| 198 | } |
| 199 | newHome := int32(derpIP.Port()) |
| 200 | if b.homeDerp != newHome { |
| 201 | b.homeDerp = newHome |
| 202 | return true |
| 203 | } |
| 204 | return false |
| 205 | } |
| 206 | |
| 207 | // Store an anonymized proto.Netcheck given a tailscale NetInfo. |
| 208 | func (b *TelemetryStore) setNetInfo(ni *tailcfg.NetInfo) { |