MyIpAddress 2.0.0

dotnet add package MyIpAddress --version 2.0.0
                    
NuGet\Install-Package MyIpAddress -Version 2.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MyIpAddress" Version="2.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MyIpAddress" Version="2.0.0" />
                    
Directory.Packages.props
<PackageReference Include="MyIpAddress" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MyIpAddress --version 2.0.0
                    
#r "nuget: MyIpAddress, 2.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package MyIpAddress@2.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MyIpAddress&version=2.0.0
                    
Install as a Cake Addin
#tool nuget:?package=MyIpAddress&version=2.0.0
                    
Install as a Cake Tool

MyIpAddress 2.0.0

MyIpAddress is an advanced .NET utility library for IP/network management and validation tasks.

Version 2.0.0 is fully backward compatible with version 1.0 and adds a range of advanced features for modern .NET projects while still supporting legacy .NET Framework (4.5+).


🆚 Version Comparison: 1.0 vs 2.0

Feature Version 1.0 Version 2.0
Validate IPv4
Get local IPv4 address
Access control via IP whitelist/blacklist ✅ (ASP.NET Core only, legacy safe)
Validate IPv6
Get local IPv6 address
Get public IP
Reverse DNS lookup
Check IP in CIDR range
Ping host connectivity
Get MAC addresses of local network interfaces
Calculate subnet mask from CIDR
Hostname validation
Email validation
Multi-target support (.NET 4.5+, .NET 6/7)
Backward compatibility with v1.0 N/A

📦 Installation

Install-Package MyIpAddress -Version 2.0.0
Supports:

.NET Framework 4.5+

.NET 6.0

.NET 7.0

⚡ Features
IPv4 & IPv6 validation

Get local IPv4 & IPv6 addresses

Retrieve public IP

Reverse DNS lookup

Check if an IP is in a CIDR range

Ping host connectivity

Get MAC addresses of local network interfaces

Calculate subnet mask from CIDR

Validate hostnames and email addresses

Access control via whitelist/blacklist (ASP.NET Core)

Fully backward compatible with version 1.0

🛠 Example Usage
csharp
Copy code
using MyIpAddress;

// Legacy .NET Framework
var helper = new IpAddressHelper();

// ASP.NET Core
// var helper = new IpAddressHelper(httpContextAccessor, configuration);

// Validate IPv4 & IPv6
bool isValid = helper.IsValidIpAddress("192.168.0.1");
bool isValidIPv6 = helper.IsValidIpAddress("2001:0db8:85a3::8a2e:0370:7334");

// Get local IPs
string localIPv4 = helper.GetLocalIPv4Address();
string localIPv6 = helper.GetLocalIPv6Address();

// Get public IP
string publicIP = await helper.GetPublicIpAsync();

// Check CIDR range
bool inRange = helper.IsIpInRange("192.168.0.10", "192.168.0.0/24");

// Ping a host
bool canPing = helper.PingHost("google.com");

// Retrieve MAC addresses
string[] macs = helper.GetLocalMacAddresses();

// Subnet mask from CIDR
string subnet = helper.GetSubnetMask(24);

// Hostname & Email validation
bool isValidHost = helper.IsValidHostName("example.com");
bool isValidEmail = helper.IsValidEmail("test@example.com");

// Reverse DNS
string hostName = helper.ReverseDnsLookup("8.8.8.8");
🔧 Notes
ASP.NET Core dependency (IHttpContextAccessor & IConfiguration) is only used for IsAccessGranted.

All other methods are fully compatible with legacy .NET Framework.

Version 2.0 is safe to upgrade for any projects using version 1.0 without breaking changes.
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Framework net45 is compatible.  net451 was computed.  net452 is compatible.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 is compatible.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.0 173 10/23/2025
1.0.0 159 11/18/2024