Skip to content

Bitvantage.InternetProtocol.NetworkPrefixLookup 3.1.0

Latest

Choose a tag to compare

@Bitvantage Bitvantage released this 12 Nov 13:13

The read-write lookups can now be created by generic code. Every package is version 3.1.0, targets .NET 8 and .NET 10, and is compatible with 3.0.0: package validation checks each package against 3.0.0.

Packages

New features

  • Parameterless constructors for IPNetworkLookup<TValue>, IPNetwork2Lookup<TValue>, MaxMindNetworkLookup<TValue> and IPPrefixLookup<TPrefix, TAdapter, TValue>, so that generic code with a new() constraint, Activator.CreateInstance and Lazy<T> can create an empty lookup. MaxMindNetworkLookup<TValue> keeps its default of looking up IPv4-mapped addresses as IPv4. The constructor that takes only options no longer has a default value; code that calls it compiles and behaves as before.
  • The README shows how to share a table through dependency injection: register the table with a factory, and register IReadOnlyIPPrefixLookup<IPNetwork, TValue> as the same instance for code that only reads. A container cannot create a read-write lookup from its type, because the constructors that take a sequence tie, and under native AOT it cannot build a sequence of structs at all.

Fixes

  • The constructors that build a table from a sequence document every exception they throw: ArgumentException for a prefix inside ::ffff:0:0/96 while MapIPv4MappedAddresses is on, as it is by default for MaxMind lookups, and ArgumentNullException for a null sequence or prefix.