MCPcopy Create free account
hub / github.com/encodeous/nylon / Lookup

Method Lookup

polyamide/device/allowedips.go:306–317  ·  view source on GitHub ↗
(ip []byte)

Source from the content-addressed store, hash-verified

304}
305
306func (table *AllowedIPs) Lookup(ip []byte) *Peer {
307 table.mutex.RLock()
308 defer table.mutex.RUnlock()
309 switch len(ip) {
310 case net.IPv6len:
311 return table.IPv6.lookup(ip)
312 case net.IPv4len:
313 return table.IPv4.lookup(ip)
314 default:
315 panic(errors.New("looking up unknown address type"))
316 }
317}

Callers 3

TestTrieRandomFunction · 0.95
TestTrieIPv4Function · 0.95
TestTrieIPv6Function · 0.95

Calls 1

lookupMethod · 0.80

Tested by 3

TestTrieRandomFunction · 0.76
TestTrieIPv4Function · 0.76
TestTrieIPv6Function · 0.76