#geolocation #ip-geolocation #maxmind #ip #geo-ip

geoip2

Library for reading MaxMind DB format used by GeoIP2 and GeoLite2

9 releases

0.1.7 Mar 26, 2024
0.1.6 Jan 27, 2022
0.1.5 Dec 31, 2021
0.1.4 Sep 15, 2021
0.0.1 Aug 21, 2021

#303 in Database interfaces

Download history 38/week @ 2024-07-19 55/week @ 2024-07-26 8/week @ 2024-08-02 8/week @ 2024-08-09 7/week @ 2024-08-16 2/week @ 2024-08-23 3/week @ 2024-08-30 30/week @ 2024-09-06 15/week @ 2024-09-13 93/week @ 2024-09-20 107/week @ 2024-09-27 50/week @ 2024-10-04 124/week @ 2024-10-11 82/week @ 2024-10-18 91/week @ 2024-10-25 50/week @ 2024-11-01

356 downloads per month
Used in geosuggest-core

MIT license

32KB
767 lines

GeoIP2 Reader for Rust

This library reads MaxMind GeoIP2 databases

Build Status Software License Downloads

crates.io Documentation Dependency Status

Usage

[dependencies]
geoip2 = "0.1.6"

See examples/lookup.rs for a basic example.

Benchmarks

Benchmarks required nightly Rust.

Place GeoIP2-Country.mmdb and GeoIP2-City.mmdb in the testdata folder, then run:

cargo bench

Tested on paid DB on cargo 1.56.0-nightly, Intel i7-7700, Debian 9.1.

IncSW/geoip2-rs

default

city      2,175 ns/iter (+/- 124)
country   1,123 ns/iter (+/- 111)

unsafe-str

city      1,113 ns/iter (+/- 76)
country     524 ns/iter (+/- 31)

oschwald/maxminddb-rust.

default

city      4,224 ns/iter (+/- 153)
country   2,270 ns/iter (+/- 158)

unsafe-str-decode

city      3,266 ns/iter (+/- 191)
country   1,802 ns/iter (+/- 75)

License

MIT License.

Dependencies

~230–670KB
~16K SLoC