Releases: lduchosal/ipnetwork
4.1.1
Fix
- Fixed
NullReferenceExceptionwhen displaying IPv6/128networks (Broadcast, FirstUsable, LastUsable can be null) - Fixed release workflow: retired
macos-13runner, added--skip-duplicatefor NuGet push
Downloads
| Platform | File |
|---|---|
| Windows x64 | ipnetwork-win-x64.zip |
| macOS Apple Silicon | ipnetwork-osx-arm64.tar.gz |
| macOS Intel | ipnetwork-osx-x64.tar.gz |
| Linux x64 | ipnetwork-linux-x64.tar.gz |
| Linux ARM64 | ipnetwork-linux-arm64.tar.gz |
| Chocolatey | choco install ipnetwork |
| NuGet (library) | dotnet add package IPNetwork2 |
4.1.0
What's new
- Native AOT binaries — self-contained, no .NET runtime required (~3MB)
- Multi-platform release — macOS (ARM64, x64), Linux (x64, ARM64), Windows (x64)
- Renamed binary —
ipnetworkinstead ofConsoleApplication - Chocolatey — no longer requires
dotnet-10.0-runtimedependency - GnuGetOpt 1.1.3 — strong-named on all platforms
Downloads
| Platform | File |
|---|---|
| Windows x64 | ipnetwork-win-x64.zip |
| macOS Apple Silicon | ipnetwork-osx-arm64.tar.gz |
| macOS Intel | ipnetwork-osx-x64.tar.gz |
| Linux x64 | ipnetwork-linux-x64.tar.gz |
| Linux ARM64 | ipnetwork-linux-arm64.tar.gz |
| Chocolatey | choco install ipnetwork |
| NuGet (library) | dotnet add package IPNetwork2 |
IPNetwork2 v4.0.2
IPNetwork2 v4.0.2
Changes since 4.0.1
- Removed obsolete static methods that had instance equivalents:
Contains,Overlap,Print,Subnet,TrySubnet,Supernet,TrySupernet,IsIANAReserved(IPNetwork2) - Removed
FilterEnumenum andListIPAddress(FilterEnum)overload — useFilterandListIPAddress(Filter)instead - Fixed Dependabot configuration (directory
/→/src) - Removed unused files (
.vscode/,qodana.yaml) - Added
.DS_Storeand.vscode/to.gitignore
Full changelog since 3.x
See v4.0.1 release notes for the complete list of breaking changes and improvements in the 4.0 series.
❤️ Support the project
IPNetwork2 is free and open source. If it saves you time or you use it in production, consider supporting its development:
- Sponsor on GitHub
- Bitcoin Lightning Network — see DONATE.md
Thank you!
IPNetwork2 v4.0.1
IPNetwork2 v4.0.1
Breaking Changes
Target Framework
- Dropped
netstandard2.0andSystem.Memorydependency - Supported targets:
net8.0,net9.0,net10.0,netstandard2.1
Nullable Reference Types
- Enabled
<Nullable>enable</Nullable>withTreatWarningsAsErrors - All public API methods now have proper nullability annotations (
?,[NotNullWhen(true)]) - Consumers may see new compiler warnings if passing nullable types without null checks
Removed Obsolete Methods
- Removed deprecated static methods that have instance equivalents:
Contains,Overlap,Subnet,TrySubnet,Supernet,TrySupernet,Print,IsIANAReserved(IPNetwork2) - Removed
FilterEnumenum andListIPAddress(FilterEnum)overload - Use the instance methods instead
IANA Reserved Blocks (#376)
IsIANAReserved()now returnstruefor many more addresses — applications relying on the previous (incomplete) behavior may be affected- Added 11 IPv4 reserved blocks: This network (
0.0.0.0/8), Loopback (127.0.0.0/8), Link-local (169.254.0.0/16), IETF Protocol (192.0.0.0/24), TEST-NET-1/2/3, Benchmarking (198.18.0.0/15), Multicast (224.0.0.0/4), Reserved (240.0.0.0/4), Broadcast (255.255.255.255/32) - Added 9 IPv6 reserved blocks: Unspecified (
::/128), Loopback (::1/128), IPv4-mapped (::ffff:0:0/96), IPv4/IPv6 translation (64:ff9b::/96), TEREDO (2001::/32), Documentation (2001:db8::/32), Unique local (fc00::/7), Link-local (fe80::/10), Multicast (ff00::/8) IsIANAReserved()now supports IPv6 addresses and networks natively
Improvements
Code Quality
- Enabled
EnforceCodeStyleInBuildandWarningLevel 5 - Fixed CA2208: descriptive messages for all
ArgumentExceptioninstances - Fixed IDE0041: pattern matching
is nullinstead ofReferenceEquals - Fixed IDE0056: index-from-end operator
[^1] - Fixed CA1847:
string.Contains(char)instead ofstring.Contains(string) - Fixed CA1850: static
SHA256.HashDataon .NET 5+ targets - Fixed SA1507: removed multiple consecutive blank lines
- Refactored
InternalToNetmaskandInternalSubnetfromvoidtoboolwith[NotNullWhen(true)]— eliminated null-forgiving operators
Tests
- Fixed MSTEST0051:
Assert.ThrowsExactlylambdas now contain single statements - Fixed S2699: added missing assertions to 11 test methods
- Removed obsolete
#pragma warning disable 0618pragmas - Added 72 new tests for IANA reserved blocks
- 1298 tests, all passing
Misc
- Fixed typo:
sanitanize→sanitize - Added
.DS_Storeto.gitignore
❤️ Support the project
IPNetwork2 is free and open source. If it saves you time or you use it in production, consider supporting its development:
- Sponsor on GitHub
- Bitcoin Lightning Network — see DONATE.md
Thank you!
IPNetwork2 v4.0.0
⚠️ Recommended upgrade: please use v4.0.1Version 4.0.0 mistakenly kept the obsolete static methods (
Contains,Overlap,Subnet,Supernet, etc.) instead of removing them. Version 4.0.1 properly removes these methods.If you are migrating from 3.x, go directly to 4.0.1.
3.5.3
Full Changelog: 3.5.2...3.5.3
3.5.2
Full Changelog: 3.5.1...3.5.2
3.5.1
Full Changelog: 3.5...3.5.1
3.5
What's Changed
- feat/operator-add-int by @lduchosal in #365
- fix/369-firstusable-lastusable-31-network by @lduchosal in #370
Full Changelog: 3.4...3.5
ParseRange & TryParseRange
ParseRange and TryParseRange
A C# utility for converting IP address ranges into optimal CIDR blocks, supporting both IPv4 and IPv6 addresses.
Both IPv4 and IPv6 ranges are supported
The algorithm generates the minimal set of CIDR blocks that exactly cover the specified range
Input format must be "startIP - endIP" with a single hyphen separator
Whitespace around IP addresses is automatically trimmed
Mixed IPv4/IPv6 ranges are not supported (both addresses must be the same family)
IPv4 Example
string ipv4Range = "192.168.1.45 - 192.168.1.65";
var ipv4Blocks = IPNetwork2.ParseRange(ipv4Range);
Console.WriteLine($"CIDR blocks for {ipv4Range}:");
foreach (var block in ipv4Blocks)
{
Console.WriteLine($" {block}");
}Output
CIDR blocks for 192.168.1.45 - 192.168.1.65:
192.168.1.45/32
192.168.1.46/31
192.168.1.48/28
192.168.1.64/31
IPv6 Example
string ipv6Range = "2001:db8::1000 - 2001:db8::1fff";
var ipv6Blocks = IPNetwork2.ParseRange(ipv6Range);
Console.WriteLine($"CIDR blocks for {ipv6Range}:");
foreach (var block in ipv6Blocks)
{
Console.WriteLine($" {block}");
}Ouput
CIDR blocks for 2001:db8::1000 - 2001:db8::1fff:
2001:db8::1000/116