Closed farwydi closed 2 months ago
I would imagine
(lpm, val, ok) := t.LookupPrefixLPM(netip.PrefixFrom(ip, ip.BitLen())
should do the trick, no?
EDIT: take the fact that ip.Prefix returns two values into account. EDIT2: just use PrefixFrom()
use LookupPrefixLPM and read the docstring
If LookupPrefixLPM is to be used for IP addresses, they must be converted to /32 or /128 prefixes.
what is your use case? The fastest method is to add the prefix to the payload and unwrap it from the returned value.
I added LookupLPM in the devel branch, but building the lpm out of the trie is expensive (20-30% slower than Lookup)
no feedback, closing the issue
Hello You recently removed the prefix return value from the lookup function.
How can I now get the prefix from the IP?
old:
new:
I see only this option