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

Method Lookup

polyamide/device/allowedips_rand_test.go:60–68  ·  view source on GitHub ↗
(addr []byte)

Source from the content-addressed store, hash-verified

58}
59
60func (r SlowRouter) Lookup(addr []byte) *Peer {
61 for _, t := range r {
62 common := commonBits(t.bits, addr)
63 if common >= t.cidr {
64 return t.peer
65 }
66 }
67 return nil
68}
69
70func (r SlowRouter) RemoveByPeer(peer *Peer) SlowRouter {
71 n := 0

Callers 1

TestTrieRandomFunction · 0.95

Calls 1

commonBitsFunction · 0.85

Tested by

no test coverage detected