Skip to main content

Module mmdb

Module mmdb 

Source
Expand description

A reader for MaxMind DB files (the MMDB format that MaxMind’s GeoLite2 and DB-IP’s free databases use), so location needs no other crate. It answers what the TypeScript server’s mmdb-lib answers: the record for an address as a JSON value, or None when the address is not in the database.

A database opened from a file is read a page at a time as lookups need it, so a 130 MB city database costs each lookup a few hundred kilobytes of reads.

Format: https://maxmind.github.io/MaxMind-DB/

Structs§

Mmdb
An MMDB database.
MmdbError
A database that could not be read.

Functions§

city_name
A city as people say it, without a trailing bracketed district.
found_in
What a lookup makes of a database record. DB-IP’s records follow MaxMind’s city layout, with names but no subdivision codes; a city loses the district DB-IP adds in brackets, as in “Toronto (Old Toronto)”. This is the TypeScript server’s lookupFrom.