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

Method nodePlacement

polyamide/device/allowedips.go:88–99  ·  view source on GitHub ↗
(ip []byte, cidr uint8)

Source from the content-addressed store, hash-verified

86}
87
88func (node *trieEntry) nodePlacement(ip []byte, cidr uint8) (parent *trieEntry, exact bool) {
89 for node != nil && node.cidr <= cidr && commonBits(node.bits, ip) >= node.cidr {
90 parent = node
91 if parent.cidr == cidr {
92 exact = true
93 return
94 }
95 bit := node.choose(ip)
96 node = node.child[bit]
97 }
98 return
99}
100
101func (trie parentIndirection) insert(ip []byte, cidr uint8, peer *Peer) {
102 if *trie.parentBit == nil {

Callers 2

insertMethod · 0.80
RemoveMethod · 0.80

Calls 2

chooseMethod · 0.95
commonBitsFunction · 0.85

Tested by

no test coverage detected