Repository navigation
Bitvantage.InternetProtocol.NetworkPrefixLookup 3.0.0
Version 3 is a redesign with a new interface. The core is a multibit trie that works on bits only, the IP layer sits on top of it, and adapter packages connect other libraries' network types. Every package is version 3.0.0, targets .NET 8 and .NET 10, and is licensed under the MIT License.
Packages
- Bitvantage.InternetProtocol.NetworkPrefixLookup: the core, with no dependencies.
- Bitvantage.InternetProtocol.NetworkPrefixLookup.IPNetwork2, new: lookups over
IPNetwork2networks. - Bitvantage.InternetProtocol.NetworkPrefixLookup.MaxMind, new: loads a whole MaxMind DB file into a lookup table.
Breaking changes
- The license is now the MIT License. Versions before 3.0.0 remain under the GNU Affero General Public License v3.0.
- The packages target .NET 8 and .NET 10. .NET 7 is no longer supported.
- Every type is in the namespace
Bitvantage.InternetProtocol.NetworkPrefixLookup. NetworkPrefixLookup<TValue>withNetworkPrefixis replaced byIPNetworkLookup<TValue>withSystem.Net.IPNetwork, and the core package no longer depends onBitvantage.InternetProtocol.NetworkPrefix.IPNetworkLookup<NoValue>replaces the lookup without values.ConcurrenceNetworkPrefixLookupis removed. Any number of threads can read anIPNetworkLookup<TValue>without locks while one writes, and writes are serialized internally.GetMatch(address)becomesTryGetMatch(address, out network, out value), andGetMatches(address)returnsPrefixEntryrecords.TryRemove(prefix)becomesRemove(prefix).TryRemove(prefix, expectedValue)removes a prefix only when its value matches.ToTextTree(IPVersion)andToDotSvgTreebecomeToTextTree(AddressFamily)andToDotTree(AddressFamily), which is rendered with Graphviz.
The changelog maps each version 2 member to its replacement.
New features
- Frozen tables, built by
Freeze, with faster lookups and a layout chosen from the data. - Lookups from bytes and integers, for callers that never create an
IPAddress. Single lookups allocate nothing. - Queries about networks:
TryGetMatch,GetMatches,GetSubnetsandOverlapsfor a network. ContainsMatch,TryGetMatchValue,IPv4CountandIPv6Count.- Batches through
BeginBatchandWriteBatch, which publish all of their writes at once, and the conditional writesTryUpdate,TryRemoveandRemove(network, out value). - Constructors that build a table in one pass from key-value pairs or from another lookup's entries.
IPLookupOptions.MapIPv4MappedAddresses, which answers IPv4-mapped addresses from dual-mode sockets as the IPv4 addresses they hold.- The
IPNetwork2andMaxMindadapter packages, andMaxMindDatabase.Loadfor whole MaxMind DB files. BitTrieandFrozenBitTriefor keys other than IP addresses, withBits32andBits128keys.- Support for trimming and native AOT, Source Link, and symbol packages.
Fixes
ToTextTreeno longer cuts the last character of its output on Linux and macOS. It removed its trailing line break by deleting two characters, which assumed Windows line endings.