I need to create a whitelist / blocklist for IPv6.
What in-memory options are there for maintaining information on a per-host or per-network basis in IPv6?
I currently use a HashTable<UInt32>
for IPv4, but never really mastered the subnet tracking, CIDR etc. IPv6 has many different ways of expressing IP ranges, complicating my effort to group IPs together, and account for them.
That being said.. what is the most efficient way (in search speed, or in-memory compactness) to have such a blocklist / whitelist?
TL;DR Question
How do I find if a
UInt128
is in a list/btree/hashtable? Which data structure is appropriate for this?How do find IP's that are "near" each other. This is normally called CIDR, but we can also express this as a value comparison of a BigInt.
One approach that just came across my mind is how a cryptographic accumulator works. Maybe there is a way to leverage the "membership" abilities of an accumulator into the need to determine if a number is a member of a set