IP2Region.Net 3.0.2

dotnet add package IP2Region.Net --version 3.0.2
                    
NuGet\Install-Package IP2Region.Net -Version 3.0.2
                    
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="IP2Region.Net" Version="3.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="IP2Region.Net" Version="3.0.2" />
                    
Directory.Packages.props
<PackageReference Include="IP2Region.Net" />
                    
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 IP2Region.Net --version 3.0.2
                    
#r "nuget: IP2Region.Net, 3.0.2"
                    
#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 IP2Region.Net@3.0.2
                    
#: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=IP2Region.Net&version=3.0.2
                    
Install as a Cake Addin
#tool nuget:?package=IP2Region.Net&version=3.0.2
                    
Install as a Cake Tool

IP2Region.Net

.NET client library for IP2Region

Installation

Install the package with NuGet

Install-Package IP2Region.Net

Usage

using IP2Region.Net.Abstractions;
using IP2Region.Net.XDB;

ISearcher searcher = new Searcher(CachePolicy , "your xdb file path");

Cache Policy Description

Cache Policy Description Thread Safe
CachePolicy.Content Cache the entire xdb data. Yes
CachePolicy.VectorIndex Cache vecotorIndex to speed up queries and reduce system io pressure by reducing one fixed IO operation. Yes
CachePolicy.File Completely file-based queries Yes

XDB File Description

Generate using maker, or download pre-generated xdb files

ASP.NET Core Usage

services.AddIP2RegionService("your xdb file path", cachePolicy: CachePolicy.Content);

NET6/7

provider.GetRequiredService<ISearcher>()

NET8+ support keyed service

provider.GetRequiredKeyedService<ISearcher>("IP2Region.Net");

TargetFrameworks

netstandard2.0;netstandard2.1;net6.0;net7.0;net8.0;net9.0;net10.0

Performance

// * Summary *

BenchmarkDotNet v0.15.6, Windows 11 (10.0.26200.7171) 13th Gen Intel Core i7-13700 2.10GHz, 1 CPU, 24 logical and 16 physical cores .NET SDK 10.0.100 [Host] : .NET 10.0.0 (10.0.0, 10.0.25.52411), X64 RyuJIT x86-64-v3 DefaultJob : .NET 10.0.0 (10.0.0, 10.0.25.52411), X64 RyuJIT x86-64-v3

Method Mean Error StdDev Gen0 Allocated
ContentIPv4 53.70 ns 0.296 ns 0.277 ns 0.0086 136 B
VectorIPv4 4,446.04 ns 18.673 ns 15.593 ns 0.0076 232 B
FileIPv4 6,712.40 ns 15.718 ns 13.934 ns 0.0153 264 B
ContentIPv6 145.53 ns 0.331 ns 0.277 ns 0.0126 200 B
VectorIPv6 7,058.39 ns 125.505 ns 117.398 ns 0.0381 712 B
FileIPv6 10,657.97 ns 53.907 ns 50.425 ns 0.0458 744 B

// * Hints * Outliers Benchmarks.VectorIPv4: Default → 2 outliers were removed (4.55 us, 4.58 us) Benchmarks.FileIPv4: Default → 1 outlier was removed (6.79 us) Benchmarks.ContentIPv6: Default → 2 outliers were removed (148.08 ns, 152.27 ns)

// * Legends * Mean : Arithmetic mean of all measurements Error : Half of 99.9% confidence interval StdDev : Standard deviation of all measurements Gen0 : GC Generation 0 collects per 1000 operations Allocated : Allocated memory per single operation (managed only, inclusive, 1KB = 1024B) 1 ns : 1 Nanosecond (0.000000001 sec)

// * Diagnostic Output - MemoryDiagnoser *

// ***** BenchmarkRunner: End ***** Run time: 00:02:06 (126.09 sec), executed benchmarks: 6

Global total time: 00:02:13 (133.47 sec), executed benchmarks: 6 // * Artifacts cleanup * Artifacts cleanup is finished

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

Apache License 2.0

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  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.  net10.0 is compatible.  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 Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  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 tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (21)

Showing the top 5 NuGet packages that depend on IP2Region.Net:

Package Downloads
DH.Services

DH框架服务库

Abc.Utils

Abc.Utils 至少NET8.0,Furion 最低NET8.0

XiHan.Framework.Web.Core

曦寒框架 Web 核心库

BootstrapBlazor.IP2Region

Bootstrap UI components extensions of IP2Region.NET

ZhonTai.Admin.Core

中台Admin权限管理核心库

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.0.2 2,728 3/3/2026
3.0.1 592 2/12/2026
3.0.0 2,414 11/27/2025
2.0.2 141,364 10/2/2023
2.0.1 3,330 7/30/2023
2.0.0 1,682 7/26/2023
1.0.10 20,832 9/7/2022
1.0.6 633 9/7/2022
1.0.5 649 9/7/2022
1.0.4 714 9/7/2022
1.0.3 633 9/7/2022
1.0.2 589 9/6/2022
1.0.1 583 9/6/2022
1.0.0 661 9/6/2022

Please refer to CHANGELOG.md for details