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)
| 271 | // |
| 272 | // b.mu must be held. |
| 273 | func (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 | |
| 284 | func (b *TelemetryStore) hashAddrorHostname(addr string) string { |
| 285 | if hashStr, ok := b.hashCache[addr]; ok { |
no test coverage detected