IPAddressRange 6.2.0
dotnet add package IPAddressRange --version 6.2.0
NuGet\Install-Package IPAddressRange -Version 6.2.0
<PackageReference Include="IPAddressRange" Version="6.2.0" />
<PackageVersion Include="IPAddressRange" Version="6.2.0" />
<PackageReference Include="IPAddressRange" />
paket add IPAddressRange --version 6.2.0
#r "nuget: IPAddressRange, 6.2.0"
#addin nuget:?package=IPAddressRange&version=6.2.0
#tool nuget:?package=IPAddressRange&version=6.2.0
IPAddressRange Class Library

This library allows you to parse range of IP address string such as "192.168.0.0/24" and "192.168.0.0/255.255.255.0" and "192.168.0.0-192.168.0.255", and can contains check. This library supports both IPv4 and IPv6.
Examples
using NetTools;
...
// rangeA.Begin is "192.168.0.0", and rangeA.End is "192.168.0.255".
var rangeA = IPAddressRange.Parse("192.168.0.0/255.255.255.0");
rangeA.Contains(IPAddress.Parse("192.168.0.34")); // is True.
rangeA.Contains(IPAddress.Parse("192.168.10.1")); // is False.
rangeA.ToCidrString(); // is 192.168.0.0/24
// rangeB.Begin is "192.168.0.10", and rangeB.End is "192.168.10.20".
var rangeB1 = IPAddressRange.Parse("192.168.0.10 - 192.168.10.20");
rangeB1.Contains(IPAddress.Parse("192.168.3.45")); // is True.
rangeB1.Contains(IPAddress.Parse("192.168.0.9")); // is False.
// Support shortcut range description.
// ("192.168.10.10-20" means range of begin:192.168.10.10 to end:192.168.10.20.)
var rangeB2 = IPAddressRange.Parse("192.168.10.10-20");
// Support CIDR expression and IPv6.
var rangeC = IPAddressRange.Parse("fe80::/10");
rangeC.Contains(IPAddress.Parse("fe80::d503:4ee:3882:c586%3")); // is True.
rangeC.Contains(IPAddress.Parse("::1")); // is False.
// "Contains()" method also support IPAddressRange argument.
var rangeD1 = IPAddressRange.Parse("192.168.0.0/16");
var rangeD2 = IPAddressRange.Parse("192.168.10.0/24");
rangeD1.Contains(rangeD2); // is True.
// IEnumerable<IPAddress> support, it's lazy evaluation.
foreach (var ip in IPAddressRange.Parse("192.168.0.1/23"))
{
Console.WriteLine(ip);
}
// You can use LINQ via "AsEnumerable()" method.
var longValues = IPAddressRange.Parse("192.168.0.1/23")
.AsEnumerable()
.Select(ip => BitConvert.ToInt32(ip.GetAddressBytes(), 0))
.Select(adr => adr.ToString("X8"));
Console.WriteLine(string.Join(",", longValues);
// Constructors from IPAddress objects.
var ipBegin = IPAddress.Parse("192.168.0.1");
var ipEnd = IPAddress.Parse("192.168.0.128");
var ipSubnet = IPAddress.Parse("255.255.255.0");
var rangeE = new IPAddressRange(); // This means "0.0.0.0/0".
var rangeF = new IPAddressRange(ipBegin, ipEnd);
var rangeG = new IPAddressRange(ipBegin, maskLength: 24);
var rangeH = new IPAddressRange(ipBegin, IPAddressRange.SubnetMaskLength(ipSubnet));
// Calculates Cidr subnets
var rangeI = IPAddressRange.Parse("192.168.0.0-192.168.0.254");
rangeI.ToCidrString(); // is 192.168.0.0/24
Release Note
The release notes is here.
License
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. 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 is compatible. 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 is compatible. 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. |
.NET Core | netcoreapp1.0 was computed. netcoreapp1.1 was computed. netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard1.4 is compatible. netstandard1.5 was computed. netstandard1.6 was computed. netstandard2.0 was computed. netstandard2.1 is compatible. |
.NET Framework | net461 was computed. net462 is compatible. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen30 was computed. tizen40 was computed. tizen60 was computed. |
Universal Windows Platform | uap was computed. uap10.0 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.6.2
- No dependencies.
-
.NETStandard 1.4
- NETStandard.Library (>= 1.6.1)
-
.NETStandard 2.1
- No dependencies.
-
net5.0
- No dependencies.
-
net6.0
- No dependencies.
-
net7.0
- No dependencies.
-
net8.0
- No dependencies.
-
net9.0
- No dependencies.
NuGet packages (40)
Showing the top 5 NuGet packages that depend on IPAddressRange:
Package | Downloads |
---|---|
Ocelot
Ocelot is an API gateway based on .NET stack. |
|
IPAddressRange.Signed
[Superseded] This package became only metadata package for installing "IPAddressRange" NuGet package, because "IPAddressRange" NuGet package became strong-named assembly. Please consider to installing "IPAddress" NuGet package directly instead of this package. ---------------------------- This library allows you to parse range of IP address string such as "192.168.0.0/24" and "192.168.0.0/255.255.255.0" and "192.168.0.0-192.168.0.255", and can contains check. This library supports both IPv4 and IPv6. |
|
WhoisClient.NET
This library is a WHOIS protocol client used to search owner information by IP address or domain name. This library determines the WHOIS server automatically and queries the referral server recursively. The response of the whois query contains strongly typed values, and the raw output. |
|
ZNetCS.AspNetCore.IPFiltering
A middleware that allows whitelist or blacklist incomming requests based on IP address. It can be configured using single IP address or ranges. It supports single IP, IP range IPv4 and IPv6. There is also possible to ignore specific paths from IP filtering. |
|
DNTCommon.Web.Core
DNTCommon.Web.Core provides common scenarios' solutions for ASP.NET Core applications. |
GitHub repositories (16)
Showing the top 16 popular GitHub repositories that depend on IPAddressRange:
Repository | Stars |
---|---|
Sonarr/Sonarr
Smart PVR for newsgroup and bittorrent users.
|
|
Radarr/Radarr
Movie organizer/manager for usenet and torrent users.
|
|
ThreeMammals/Ocelot
.NET API Gateway
|
|
Prowlarr/Prowlarr
Prowlarr is an indexer manager/proxy built on the popular *arr .net/reactjs base stack to integrate with your various PVR apps, supporting management of both Torrent Trackers and Usenet Indexers.
|
|
Lidarr/Lidarr
Looks and smells like Sonarr but made for music.
|
|
Readarr/Readarr
Book Manager and Automation (Sonarr for Ebooks)
|
|
slskd/slskd
A modern client-server application for the Soulseek file sharing network.
|
|
duyanming/Viper
Viper 是一个基于Anno微服务引擎开发的Dashboard示例项目。Anno 底层通讯采用 grpc、thrift。自带服务发现、调用链追踪、Cron 调度、限流、事件总线等等
|
|
LeonKou/NetPro
🌈An enhanced version with clean architecture of asp.netcore,efficiently manage startup,Support for netcore3.1/6.0
|
|
bitbrute/evillimiter-windows
Tool that limits bandwidth of devices on the same network without access.
|
|
andruzzzhka/BeatSaberMultiplayer
|
|
DigitalRuby/MailDemon
Smtp server for mass emailing, managing email lists and more. Built on .NET Core. Linux, MAC and Windows compatible.
|
|
VahidN/DNTCommon.Web.Core
DNTCommon.Web.Core provides common scenarios' solutions for ASP.NET Core applications.
|
|
ThereGoesMySanity/osuMissAnalyzer
A program to analyze misses in an osu! replay
|
|
dukeofharen/httplaceholder
A very flexible cross platform HTTP stub application.
|
|
microsoft/WhoisParsers
Download and parse Whois records from bulk whois database dumps of IANA organizations (ARIN, AFRINIC, APNIC, LACNIC, RIPE ). Crawl and parse RWhois records from RFC 2167 ARIN Referral Whois Servers
|
Version | Downloads | Last updated |
---|---|---|
6.2.0 | 4,839 | 10 days ago |
6.1.0 | 632,802 | 5 months ago |
6.0.0 | 4,235,866 | 6/1/2023 |
4.0.0 | 3,100,190 | 8/31/2019 |
3.2.2 | 285,087 | 8/12/2019 |
3.2.1 | 254,574 | 6/26/2019 |
3.2.0 | 1,403,711 | 5/1/2018 |
3.1.1 | 8,134 | 4/26/2018 |
3.1.0 | 71,657 | 3/22/2018 |
3.0.0.1 | 10,729 | 3/3/2018 |
3.0.0-beta | 1,725 | 2/23/2018 |
2.2.0 | 17,976 | 1/29/2018 |
2.1.1 | 82,907 | 11/28/2017 |
2.1.1-beta | 1,844 | 11/20/2017 |
2.1.0.1 | 56,524 | 11/16/2017 |
2.1.0-alpha | 1,813 | 11/1/2017 |
2.0.0.4 | 272,827 | 9/15/2017 |
2.0.0.3 | 132,890 | 7/4/2017 |
2.0.0.3-beta | 1,789 | 5/29/2017 |
2.0.0-beta | 2,031 | 5/19/2017 |
1.6.2.7 | 71,677 | 3/8/2017 |
1.6.2.6-beta | 1,747 | 3/1/2017 |
1.6.2.1-beta | 2,467 | 11/29/2016 |
1.6.1 | 80,987 | 9/27/2016 |
1.6.0 | 51,028 | 5/23/2016 |
1.5.0 | 253,244 | 10/16/2015 |
1.4.0.1 | 5,987 | 8/22/2015 |
1.4.0 | 24,259 | 6/3/2015 |
1.3.0.1 | 4,349 | 4/1/2015 |
1.3.0 | 2,088 | 4/1/2015 |
1.2.1 | 4,867 | 2/19/2015 |
1.2.0 | 62,713 | 2/5/2015 |
1.1.0-beta | 3,310 | 11/4/2014 |
1.0.6 | 15,341 | 3/10/2014 |
1.0.5 | 4,111 | 12/9/2013 |
1.0.4 | 2,176 | 12/9/2013 |
1.0.3 | 2,181 | 12/9/2013 |
1.0.2 | 13,692 | 5/28/2012 |
1.0.1 | 3,264 | 5/22/2012 |
1.0.0 | 5,104 | 5/17/2012 |
v.6.2.0
- Added AddressCount property to retrieve number of addresses contained by range (PR #86 contributed by @Makaopior)
To see all the change logs, please visit the following URL.
- https://github.com/jsakamoto/IPAddressRange/blob/master/RELEASE-NOTES.txt