45 releases (20 breaking)

new 0.21.0 Jul 20, 2021
0.19.0 Jun 25, 2021
0.17.2 Feb 12, 2021
0.17.0 Dec 12, 2020
0.1.0 Nov 22, 2014

#11 in Database interfaces

Download history 5688/week @ 2021-04-06 5514/week @ 2021-04-13 5760/week @ 2021-04-20 6228/week @ 2021-04-27 5052/week @ 2021-05-04 5519/week @ 2021-05-11 5740/week @ 2021-05-18 5393/week @ 2021-05-25 5112/week @ 2021-06-01 6387/week @ 2021-06-08 6734/week @ 2021-06-15 7142/week @ 2021-06-22 5861/week @ 2021-06-29 6319/week @ 2021-07-06 6989/week @ 2021-07-13 6279/week @ 2021-07-20

25,589 downloads per month
Used in 10 crates (9 directly)

ISC license


Rust MaxMind DB Reader

crates.io Released API docs Master API docs

This library reads the MaxMind DB format, including the GeoIP2 and GeoLite2 databases.


To build everything:

cargo build


This crate manages its test data within a git submodule. To run the tests, you will first need to run the following command.

git submodule update --init


Add this to your Cargo.toml:

maxminddb = "0.17"

and this to your crate root:

extern crate maxminddb;

API Documentation

The API docs are on GitHub Pages.


See examples/lookup.rs for a basic example.


The projects include benchmarks using Criterion.rs.

First you need to have a working copy of the GeoIP City database. You can fetch it from here.

Place it in the root folder as GeoIP2-City.mmdb.

Once this is done, run

cargo bench

If gnuplot is installed, Criterion.rs can generate an HTML report displaying the results of the benchmark under target/criterion/report/index.html.

Result of doing 100 random IP lookups:


Contributions welcome! Please fork the repository and open a pull request with your changes.


This is free software, licensed under the ISC license.


~34K SLoC