(proto *tailnetproto.TelemetryEvent)
| 2127 | } |
| 2128 | |
| 2129 | func NetworkEventFromProto(proto *tailnetproto.TelemetryEvent) (NetworkEvent, error) { |
| 2130 | if proto == nil { |
| 2131 | return NetworkEvent{}, xerrors.New("nil event") |
| 2132 | } |
| 2133 | id, err := uuid.FromBytes(proto.Id) |
| 2134 | if err != nil { |
| 2135 | return NetworkEvent{}, xerrors.Errorf("parse id %q: %w", proto.Id, err) |
| 2136 | } |
| 2137 | |
| 2138 | return NetworkEvent{ |
| 2139 | ID: id, |
| 2140 | Time: proto.Time.AsTime(), |
| 2141 | Application: proto.Application, |
| 2142 | Status: strings.ToLower(proto.Status.String()), |
| 2143 | ClientType: strings.ToLower(proto.ClientType.String()), |
| 2144 | ClientVersion: proto.ClientVersion, |
| 2145 | NodeIDSelf: proto.NodeIdSelf, |
| 2146 | NodeIDRemote: proto.NodeIdRemote, |
| 2147 | P2PEndpoint: p2pEndpointFromProto(proto.P2PEndpoint), |
| 2148 | HomeDERP: int(proto.HomeDerp), |
| 2149 | DERPMap: derpMapFromProto(proto.DerpMap), |
| 2150 | LatestNetcheck: netcheckFromProto(proto.LatestNetcheck), |
| 2151 | |
| 2152 | ConnectionAge: protoDurationNil(proto.ConnectionAge), |
| 2153 | ConnectionSetup: protoDurationNil(proto.ConnectionSetup), |
| 2154 | P2PSetup: protoDurationNil(proto.P2PSetup), |
| 2155 | DERPLatency: protoDurationNil(proto.DerpLatency), |
| 2156 | P2PLatency: protoDurationNil(proto.P2PLatency), |
| 2157 | ThroughputMbits: protoFloat(proto.ThroughputMbits), |
| 2158 | }, nil |
| 2159 | } |
| 2160 | |
| 2161 | type Organization struct { |
| 2162 | ID uuid.UUID `json:"id"` |
no test coverage detected