Skip to content

Bitvantage.InternetProtocol.NetworkPrefixLookup 3.0.0

Choose a tag to compare

@Bitvantage Bitvantage released this 11 Nov 20:04
· 1 commit to main since this release

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

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> with NetworkPrefix is replaced by IPNetworkLookup<TValue> with System.Net.IPNetwork, and the core package no longer depends on Bitvantage.InternetProtocol.NetworkPrefix. IPNetworkLookup<NoValue> replaces the lookup without values.
  • ConcurrenceNetworkPrefixLookup is removed. Any number of threads can read an IPNetworkLookup<TValue> without locks while one writes, and writes are serialized internally.
  • GetMatch(address) becomes TryGetMatch(address, out network, out value), and GetMatches(address) returns PrefixEntry records.
  • TryRemove(prefix) becomes Remove(prefix). TryRemove(prefix, expectedValue) removes a prefix only when its value matches.
  • ToTextTree(IPVersion) and ToDotSvgTree become ToTextTree(AddressFamily) and ToDotTree(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, GetSubnets and Overlaps for a network.
  • ContainsMatch, TryGetMatchValue, IPv4Count and IPv6Count.
  • Batches through BeginBatch and WriteBatch, which publish all of their writes at once, and the conditional writes TryUpdate, TryRemove and Remove(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 IPNetwork2 and MaxMind adapter packages, and MaxMindDatabase.Load for whole MaxMind DB files.
  • BitTrie and FrozenBitTrie for keys other than IP addresses, with Bits32 and Bits128 keys.
  • Support for trimming and native AOT, Source Link, and symbol packages.

Fixes

  • ToTextTree no 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.