maxminddb

Crates.iomaxminddb
lib.rsmaxminddb
version0.24.0
sourcesrc
created_at2014-11-22 21:35:03.782489
updated_at2024-01-10 00:33:46.934976
descriptionLibrary for reading MaxMind DB format used by GeoIP2 and GeoLite2
homepagehttps://github.com/oschwald/maxminddb-rust
repositoryhttps://github.com/oschwald/maxminddb-rust
max_upload_size
id355
size83,916
rustfix (github:rust-lang-nursery:rustfix)

documentation

http://oschwald.github.io/maxminddb-rust/maxminddb/struct.Reader.html

README

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.

Building

To build everything:

cargo build

Testing

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

Usage

Add this to your Cargo.toml:

[dependencies]
maxminddb = "0.17"

and this to your crate root:

extern crate maxminddb;

API Documentation

The API docs are on GitHub Pages.

Example

See examples/lookup.rs for a basic example.

Benchmarks

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:

Contributing

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

License

This is free software, licensed under the ISC license.

Commit count: 333

cargo fmt