Releases: lduchosal/ipnetwork
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
IPNetwork Library v3.3 - Major Cleanup & Breaking Changes
Release Notes - Version 3.3
🚨 Breaking Changes
IPNetwork comparison and sort order: The comparison and sorting behavior has been updated to reflect expected standards. If your code relies on the previous sorting behavior, please review and update accordingly.
✨ New Features & Improvements
Enhanced enum support: Improved enum implementations throughout the library
TryParse functionality: Added or improved TryParse methods for better error handling
Static ListIPAddress method: New static method for listing IP addresses
Exception handling: Enhanced exception handling and error reporting
🔧 Bug Fixes
Fixed obsolete enum definitions
Corrected network sorting algorithms
Improved member comparison functionality
🧹 Code Quality
Major codebase cleanup and refactoring
Improved code organization and maintainability
Migration Guide: Review any code that depends on IPNetwork sorting or comparison operations, as the behavior has been updated to match expected industry standards.
Operator Support & Smart Network Features
This release introduces significant enhancements to IP network operations and parsing capabilities:
🧮 Mathematical Operations
Addition & Subtraction Operators: Added support for + and - operators for IP network calculations, enabling intuitive arithmetic operations on network ranges
Subtract Functionality: Enhanced network subtraction capabilities for more complex IP range manipulations
🌐 Network Intelligence Features
Network-Aware CIDR Guessing: Intelligent CIDR block detection and suggestion system that understands network topology and provides smart recommendations
Enhanced Parsing & Sanitization: Improved TryParse functionality with built-in input sanitization, making IP network parsing more robust and error-resistant
📈 Key Improvements
More intuitive API for network arithmetic operations
Smarter network range detection and processing
Better input validation and error handling
Enhanced developer experience with cleaner parsing methods
These features collectively improve the library's usability for network administrators, developers, and anyone working with IP address ranges and CIDR blocks. The mathematical operators make network calculations more intuitive, while the intelligent parsing features reduce errors and improve reliability.
Total Changes: +158 additions, -33 deletions across multiple pull requests
This release maintains backward compatibility while adding powerful new functionality for modern IP network management workflows.