IP2Region.Net
3.0.0
dotnet add package IP2Region.Net --version 3.0.0
NuGet\Install-Package IP2Region.Net -Version 3.0.0
<PackageReference Include="IP2Region.Net" Version="3.0.0" />
<PackageVersion Include="IP2Region.Net" Version="3.0.0" />
<PackageReference Include="IP2Region.Net" />
paket add IP2Region.Net --version 3.0.0
#r "nuget: IP2Region.Net, 3.0.0"
#:package IP2Region.Net@3.0.0
#addin nuget:?package=IP2Region.Net&version=3.0.0
#tool nuget:?package=IP2Region.Net&version=3.0.0
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
| Product | Versions 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 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 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. |
-
.NETStandard 2.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.0)
- System.Buffers (>= 4.5.1)
- System.Memory (>= 4.5.5)
-
.NETStandard 2.1
-
net6.0
-
net7.0
-
net8.0
-
net9.0
NuGet packages (19)
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 |
|
|
ZhonTai.Admin.Core
中台Admin权限管理核心库 |
|
|
BootstrapBlazor.IP2Region
Bootstrap UI components extensions of IP2Region.NET |
|
|
Lycoris.Common
常用扩展功能及部分工具类 |
GitHub repositories (8)
Showing the top 8 popular GitHub repositories that depend on IP2Region.Net:
| Repository | Stars |
|---|---|
|
izhaorui/Zr.Admin.NET
🎉ZR.Admin.NET是一款前后端分离的、跨平台基于RBAC的通用权限管理后台。ORM采用SqlSugar。前端采用Vue、AntDesign,支持多租户、缓存、任务调度、支持统一异常处理、接口限流、支持一键生成前后端代码,支持动态国际化翻译(Vue3),等诸多黑科技,代码简洁易懂、易扩展让开发更简单、更通用。
|
|
|
xianhc/ape-volo-admin
.Net 8 、SqlSugar ORM、Vue 2.X、RBAC。前后端分离的开箱则用的企业级的权限开发框架(中后台管理系统)
|
|
|
colinin/abp-next-admin
这是基于vue-vben-admin 模板适用于abp vNext的前端管理项目
|
|
|
bing-framework/Bing.NetCore
Bing是基于 .net core 3.1 的框架,旨在提升团队的开发输出能力,由常用公共操作类(工具类、帮助类)、分层架构基类,第三方组件封装,第三方业务接口封装等组成。
|
|
|
dymproject/purest-admin
Purest Admin 是一套真正意义上前后端分离、深度适配企业RBAC权限体系的通用后台管理系统。依托现代化 .NET 10 技术栈、Vue3 生态前端、强大的工作流引擎,力求降低业务框架搭建门槛,实现一站式、敏捷、高可扩展的企业级后台管理平台。
|
|
|
Deali-Axy/StarBlog
☀StarBlog 是一个基于 .NET Core 开发的现代博客系统,支持 Markdown 文章导入,遵循 RESTful 接口规范。前端基于 Vue + ElementUI 开发,可作为 .NET Core 入门学习项目,同时配套了一系列开发笔记,记录了从零开始构建这个博客系统的全过程,可以帮助学习理解 .Net Core 项目的开发流程。
|
|
|
Redns/North
一个易于搭建的图床服务
|
|
|
DotNet-MoYu/SimpleAdmin
💥一个小而美的通用业务型后台管理系统。采用前后端分离的设计模式,基于RBAC+多机构的权限管理模式,实现接口级别的数据权限控制。集成国密加解密插件,注释详细,文档齐全,让你的开发少走弯路。
|
Please refer to CHANGELOG.md for details