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

Method processIPLocked

tailnet/telemetry.go:273–282  ·  view source on GitHub ↗

processIPLocked will look up the IP in the cache, or hash and salt it and add to the cache. It will also add it to hashedIPs. b.mu must be held.

(ip string)

Source from the content-addressed store, hash-verified

271//
272// b.mu must be held.
273func (b *TelemetryStore) processIPLocked(ip string) (string, *proto.IPFields, error) {
274 addr, err := netip.ParseAddr(ip)
275 if err != nil {
276 return "", nil, xerrors.Errorf("failed to parse IP %q: %w", ip, err)
277 }
278
279 fields := addrToFields(addr)
280 hashStr := b.hashAddrorHostname(ip)
281 return hashStr, fields, nil
282}
283
284func (b *TelemetryStore) hashAddrorHostname(addr string) string {
285 if hashStr, ok := b.hashCache[addr]; ok {

Callers 2

updateDerpMapLockedMethod · 0.95
setNetInfoMethod · 0.95

Calls 3

hashAddrorHostnameMethod · 0.95
addrToFieldsFunction · 0.85
ErrorfMethod · 0.45

Tested by

no test coverage detected