newEvent returns the current telemetry state as an event
()
| 61 | |
| 62 | // newEvent returns the current telemetry state as an event |
| 63 | func (b *TelemetryStore) newEvent() *proto.TelemetryEvent { |
| 64 | b.mu.Lock() |
| 65 | defer b.mu.Unlock() |
| 66 | |
| 67 | out := &proto.TelemetryEvent{ |
| 68 | Time: timestamppb.Now(), |
| 69 | ClientVersion: buildinfo.Version(), |
| 70 | DerpMap: DERPMapToProto(b.cleanDerpMap), |
| 71 | LatestNetcheck: b.cleanNetCheck, |
| 72 | NodeIdSelf: b.nodeIDSelf, |
| 73 | NodeIdRemote: b.nodeIDRemote, |
| 74 | HomeDerp: b.homeDerp, |
| 75 | Application: b.application, |
| 76 | } |
| 77 | if b.p2pSetupTime > 0 { |
| 78 | out.P2PSetup = durationpb.New(b.p2pSetupTime) |
| 79 | } |
| 80 | return out |
| 81 | } |
| 82 | |
| 83 | func (b *TelemetryStore) markConnected(ip *netip.Addr, application string) { |
| 84 | b.mu.Lock() |