Library
Module
Module type
Parameter
Class
Class type
Maxmind is a binding to libmaxminddb with some higher level functionality on the OCaml side. Be aware that operations with the C side are liable to raise exceptions
Type representing physical location data
type borders = {
postal_code : string;
city_name : string;
country_name : string;
continent_name : string;
iso_code : string;
}
Type representing political borders of an IP address
Languages that Maxmindb DB knows for paths ending in string queries, note that not all queries support all languages
Result of a query, mostly relevant if you are doing it by hand with calls to lookup_path
val create : path:string -> mmdb
Create a handle on a mmdb descriptor based off a .mmdb database file. Maxminddb comes with City, Country databases in etc
val close : mmdb -> unit
Close a handle on a mmdb descriptor, raises exception if you try to use the handle after you called closed on it.
val dump : ?ip:string -> mmdb -> string
Dumps the database as a string; if ip is provided then dumps the database for this particular ip address, if no ip provided then dumps Metainformation about the database itself. Note that you should do not depend on this structure: it is not JSON, just looks like it.
For a given ip address, think 127.0.0.1, query path and mmdb handle, get the result. Note path must be safe, look at dump first
val postal_code : ip:string -> mmdb -> string
Short cut function for getting postal code from ip address
Short cut function for getting a city name from ip address
Short cut function for getting a country name from ip address
Short cut function for getting a continent name from ip address
Short cut function for getting a record of physical location information
val iso_code : ip:string -> mmdb -> string
ISO code for Country of IP address
Shortcut providing top level geographical information
val with_mmdb : path:string -> (mmdb -> unit) -> unit
Convenience function that opens and closes a mmdb for you