![]() |
VOOZH | about |
dotnet add package MaxMind.Db --version 5.1.0
NuGet\Install-Package MaxMind.Db -Version 5.1.0
<PackageReference Include="MaxMind.Db" Version="5.1.0" />
<PackageVersion Include="MaxMind.Db" Version="5.1.0" />Directory.Packages.props
<PackageReference Include="MaxMind.Db" />Project file
paket add MaxMind.Db --version 5.1.0
#r "nuget: MaxMind.Db, 5.1.0"
#:package MaxMind.Db@5.1.0
#addin nuget:?package=MaxMind.Db&version=5.1.0Install as a Cake Addin
#tool nuget:?package=MaxMind.Db&version=5.1.0Install as a Cake Tool
This is the .NET API for reading MaxMind DB files. MaxMind DB is a binary file format that stores data indexed by IP address subnets (IPv4 or IPv6).
We recommend installing this library with NuGet. To do this, type the following into the Visual Studio Package Manager Console:
install-package MaxMind.Db
Note: For accessing MaxMind GeoIP2 databases, we generally recommend using the GeoIP2 .NET API rather than using this package directly.
To use the API, you must first create a Reader object. The constructor for the
reader object takes a string with the path to the MaxMind DB file. Optionally
you may pass a second parameter with a FileAccessMode enum with the value
MemoryMapped or Memory. The default mode is MemoryMapped, which maps the
file to virtual memory. This often provides performance comparable to loading
the file into real memory with the Memory mode while using significantly less
memory.
To look up an IP address, pass a System.Net.IPAddress object to the Find<T>
method on Reader. This method will return the result as type T. T may
either be a generic collection, a class using the [MaxMind.Db.Constructor]
attribute to declare which constructor to use during deserialization, or a class
with [MaxMind.Db.MapKey("name")]-annotated init properties for
property-based activation.
We recommend reusing the Reader object rather than creating a new one for each
lookup. The creation of this object is relatively expensive as it must read in
metadata for the file.
using (var reader = new Reader("GeoIP2-City.mmdb"))
{
var ip = IPAddress.Parse("24.24.24.24");
var data = reader.Find<Dictionary<string, object>>(ip);
...
}
using MaxMind.Db;
using System.Net;
namespace MyCode
{
public class Asn
{
[Constructor]
public Asn(
// The MapKey attribute tells the reader to map the database
// key to the specified constructor parameter or property.
[MapKey("autonomous_system_number")] long? autonomousSystemNumber,
[MapKey("autonomous_system_organization")] string autonomousSystemOrganization,
// The Inject attribute allows you to inject arbitrary values
// when deserializing.
[Inject("ip_address")] IPAddress ipAddress,
// The Network attribute tells the reader to set the constructor
// parameter to be the network associated with the record in the
// database.
[Network] Network network)
{
...
}
...
}
public class Program
{
private static void Main(string[] args)
{
using (var reader = new Reader("GeoLite2-ASN.mmdb"))
{
var ip = IPAddress.Parse("24.24.24.24");
var injectables = new InjectableValues();
injectables.AddValue("ip_address", ip);
var data = reader.Find<Asn>(ip, injectables);
...
}
}
}
}
As an alternative to constructor-based activation, you can use init
properties. This does not require a [Constructor]-annotated constructor.
using MaxMind.Db;
using System.Net;
namespace MyCode
{
public class Asn
{
[MapKey("autonomous_system_number")]
public long? AutonomousSystemNumber { get; init; }
[MapKey("autonomous_system_organization")]
public string? AutonomousSystemOrganization { get; init; }
[Inject("ip_address")]
public IPAddress? IpAddress { get; init; }
[Network]
public Network? Network { get; init; }
}
public class Program
{
private static void Main(string[] args)
{
using (var reader = new Reader("GeoLite2-ASN.mmdb"))
{
var ip = IPAddress.Parse("24.24.24.24");
var injectables = new InjectableValues();
injectables.AddValue("ip_address", ip);
var data = reader.Find<Asn>(ip, injectables);
...
}
}
}
}
This API fully supports use in multi-threaded applications. In such
applications, we suggest creating one Reader object and sharing that among
threads.
The MaxMind DB format is an open format for quickly mapping IP addresses to records. See the specification for more information on the format.
Please report all issues with this code using the GitHub issue tracker.
If you are having an issue with a MaxMind database or service that is not specific to this reader, please contact MaxMind support.
Patches and pull requests are encouraged. Please include unit tests whenever possible.
The MaxMind DB Reader API uses Semantic Versioning.
This software is Copyright (c) 2013-2026 by MaxMind, Inc.
This is free software, licensed under the Apache License, Version 2.0.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 is compatible. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 is compatible. |
| .NET Framework | net461 net461 was computed. net462 net462 was computed. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 5 NuGet packages that depend on MaxMind.Db:
| Package | Downloads |
|---|---|
|
MaxMind.GeoIP2
MaxMind GeoIP2 Database Reader and Web Service Client |
|
|
Dynamicweb.Admin
Package Description |
|
|
Dynamicweb.Tracking.Web
Package Description |
|
|
NopCommerce.Core
Contains the core assemblies needed to run nopcommerce. This package only contains assemblies and can be used for package development. |
|
|
MoarUtils
Useful utilities to more efficient .NET development #OnTheShouldersOfGiants |
Showing the top 12 popular GitHub repositories that depend on MaxMind.Db:
| Repository | Stars |
|---|---|
|
Archeb/opentrace
Open Source Visualized Route Tracing Tool for macOS, Windows, and Linux.
|
|
|
smartstore/SmartStoreNET
Open Source ASP.NET MVC Enterprise eCommerce Shopping Cart Solution
|
|
|
moom825/xeno-rat
Xeno-RAT is an open-source remote access tool (RAT) developed in C#, providing a comprehensive set of features for remote system management. Has features such as HVNC, live microphone, reverse proxy, and much much more!
|
|
|
smartstore/Smartstore
A modular, scalable and ultra-fast open-source all-in-one eCommerce platform built on ASP.NET Core 10
|
|
|
SparkDevNetwork/Rock
An open source CMS, Relationship Management System (RMS) and Church Management System (ChMS) all rolled into one.
|
|
|
wokhan/WFN
Windows Firewall Notifier extends the default Windows embedded firewall by allowing to handle and notify about outgoing connections, offers real time connections monitoring, connections map, bandwidth usage monitoring and more...
|
|
|
maxmind/GeoIP2-dotnet
MaxMind GeoIP2 .NET API
|
|
|
dreling8/Nop.Framework
c# asp.net mvc base development framework from nopCommerce。
|
|
|
PredatH0r/SteamServerBrowser
Browse game servers and details for games using Valve's master servers
|
|
|
ZL154/JellyfinSecurity
A Jellyfin plugin that adds native two-factor authentication (TOTP, email OTP) with trusted device tokens, TV device pairing, LAN bypass, and API key bypass. Server-side enforcement — works with all clients including web, mobile, TV, and service integrations like Sonarr/Radarr.
|
|
|
lengran/OpenPrefirePrac
An open-source CounterStrikeSharp powered server-side practicing plugin for CS2. It provides multiple prefire practices on competitive maps and support multiplayer practicing simultaneously.
|
|
|
skyprolk/Clash-Of-SL
Clash of SL Server (CSS) that is the fully free open source clash of clans private server and it is not affiliated to "Supercell , Oy " .
|
| Version | Downloads | Last Updated |
|---|---|---|
| 5.1.0 | 45,575 | 5/22/2026 |
| 5.0.0 | 36,286 | 3/12/2026 |
| 4.3.4 | 634,382 | 11/24/2025 |
| 4.3.0 | 24,313 | 11/20/2025 |
| 4.2.0 | 884,721 | 5/5/2025 |
| 4.1.0 | 9,252,519 | 12/5/2023 |
| 4.0.0 | 4,883,537 | 2/3/2022 |
| 3.0.0 | 3,195,345 | 11/16/2020 |
| 2.6.1 | 4,373,416 | 12/6/2019 |
| 2.6.0 | 11,427 | 12/6/2019 |
| 2.5.0 | 15,281 | 11/21/2019 |
| 2.4.0 | 4,033,404 | 4/11/2018 |
| 2.3.0 | 2,155,442 | 10/27/2017 |
| 2.2.0 | 294,521 | 5/8/2017 |
| 2.1.3 | 747,113 | 11/22/2016 |
| 2.1.2 | 237,122 | 8/8/2016 |
| 2.1.1 | 16,083 | 8/1/2016 |
| 2.1.1-beta1 | 4,643 | 6/1/2016 |
| 2.1.0-beta4 | 2,369 | 6/1/2016 |