IPRangeLookup 1.0.3

.NET 5.0 .NET Core 2.1 .NET Framework 4.0
NuGet\Install-Package IPRangeLookup -Version 1.0.3
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.
dotnet add package IPRangeLookup --version 1.0.3
<PackageReference Include="IPRangeLookup" Version="1.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add IPRangeLookup --version 1.0.3
#r "nuget: IPRangeLookup, 1.0.3"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install IPRangeLookup as a Cake Addin
#addin nuget:?package=IPRangeLookup&version=1.0.3

// Install IPRangeLookup as a Cake Tool
#tool nuget:?package=IPRangeLookup&version=1.0.3

Overview

This library is designed to optimize the lookup of an IP address in a set of IP Ranges. It supports both IPv4 and IPv6 addresses. It provides methods for checking if an IP address is a part of Public IP Ranges for M365 endpoints.

Usage Examples

  1. To check if an IP address is present in Public IP Ranges.

Eg: IPSearch ipSearch=new IPSearch(); bool result=ipSearch.Contains("10.0.0.0"); //false

  1. To check if an IP address is present in a list of Subnets (CIDR). 

Eg: List<string> input = new List<string> () {"12.108.10.152/30", "13.108.10.10/29"}; IPSearch ipSearch=new IPSearch(input); bool result=ipSearch.Contains("12.108.10.153"); //true

  1. To check if an IP address is present in the provided Subnet CIDR list and get the corresponding T value of the range. 

Eg: List<Tuple<string, string>> input = new List<Tuple<string, string>> () { Tuple.Create ("12.108.10.152/30" ,"abc"), Tuple.Create ("13.108.10.10/29" ,"xyz") }; IPSearch<string> ipSearch=new IPSearch<string>(input); Tuple<bool,string> result=ipSearch.Lookup("12.108.10.153"); //(true,"abc")

Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows
.NET Core netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Framework net40 net403 net45 net451 net452 net46 net461 net462 net463 net47 net471 net472 net48
Compatible target framework(s)
Additional computed target framework(s)
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
1.0.3 793 4/7/2021
1.0.2 122 3/31/2021

Initial Release