47 releases (22 breaking)

0.23.0 Apr 3, 2022
0.22.0 Mar 23, 2022
0.21.0 Jul 20, 2021
0.17.2 Feb 12, 2021
0.1.0 Nov 22, 2014

#37 in Database interfaces

Download history 19264/week @ 2023-06-02 18141/week @ 2023-06-09 18943/week @ 2023-06-16 18415/week @ 2023-06-23 19424/week @ 2023-06-30 19002/week @ 2023-07-07 19820/week @ 2023-07-14 20102/week @ 2023-07-21 19657/week @ 2023-07-28 19723/week @ 2023-08-04 19618/week @ 2023-08-11 21053/week @ 2023-08-18 21593/week @ 2023-08-25 20291/week @ 2023-09-01 20328/week @ 2023-09-08 14729/week @ 2023-09-15

80,589 downloads per month
Used in 25 crates (23 directly)

ISC license

1.5K SLoC

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.


~32K SLoC