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

Method toEndpoint

tailnet/telemetry.go:251–267  ·  view source on GitHub ↗
(ipport string)

Source from the content-addressed store, hash-verified

249}
250
251func (b *TelemetryStore) toEndpoint(ipport string) *proto.TelemetryEvent_P2PEndpoint {
252 b.mu.Lock()
253 defer b.mu.Unlock()
254
255 addrport, err := netip.ParseAddrPort(ipport)
256 if err != nil {
257 return nil
258 }
259 addr := addrport.Addr()
260 fields := addrToFields(addr)
261 hashStr := b.hashAddrorHostname(addr.String())
262 return &proto.TelemetryEvent_P2PEndpoint{
263 Hash: hashStr,
264 Port: int32(addrport.Port()),
265 Fields: fields,
266 }
267}
268
269// processIPLocked will look up the IP in the cache, or hash and salt it and add
270// to the cache. It will also add it to hashedIPs.

Callers 1

sendPingTelemetryMethod · 0.80

Calls 6

hashAddrorHostnameMethod · 0.95
addrToFieldsFunction · 0.85
LockMethod · 0.45
UnlockMethod · 0.45
AddrMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected