MCPcopy Index your code
hub / github.com/coder/coder / NetworkEventFromProto

Function NetworkEventFromProto

coderd/telemetry/telemetry.go:2129–2159  ·  view source on GitHub ↗
(proto *tailnetproto.TelemetryEvent)

Source from the content-addressed store, hash-verified

2127}
2128
2129func 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
2161type Organization struct {
2162 ID uuid.UUID `json:"id"`

Callers 1

Calls 8

p2pEndpointFromProtoFunction · 0.85
derpMapFromProtoFunction · 0.85
netcheckFromProtoFunction · 0.85
protoDurationNilFunction · 0.85
protoFloatFunction · 0.85
NewMethod · 0.65
ErrorfMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected