(ipport string)
| 249 | } |
| 250 | |
| 251 | func (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. |
no test coverage detected