Repository navigation
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
- Bitvantage.InternetProtocol.NetworkPrefixLookup: the core, with no dependencies.
- Bitvantage.InternetProtocol.NetworkPrefixLookup.IPNetwork2: lookups over
IPNetwork2networks. - Bitvantage.InternetProtocol.NetworkPrefixLookup.MaxMind: loads a whole MaxMind DB file into a lookup table.
New features
- Parameterless constructors for
IPNetworkLookup<TValue>,IPNetwork2Lookup<TValue>,MaxMindNetworkLookup<TValue>andIPPrefixLookup<TPrefix, TAdapter, TValue>, so that generic code with anew()constraint,Activator.CreateInstanceandLazy<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:
ArgumentExceptionfor a prefix inside::ffff:0:0/96whileMapIPv4MappedAddressesis on, as it is by default for MaxMind lookups, andArgumentNullExceptionfor a null sequence or prefix.