/usr/lib/libgeolite2++
.a or /usr/lib/libgeolite2++
.so.
.mmdb database file. See /usr/bin/geolite2pp_get_database
.sh or http://dev.maxmind.com/geoip/geoip2/geolite2/#Downloads Query the GeoLite2 database and return a JSON string with the details for the given address:
Query the GeoLite2 database and return very specific field values for the given address:
The fields in the vector (e.g., "city"
, "names"
, "en"
) are used to traverse the structures and return exact values. This traversal path can be determined by comparing against the .json output from the previous call, part of which is:
Calling db.get_field()
with a vector containing "city", "names", "en"
would return the English name for the given city, or "Mountain View"
in this example.
For additional details and methods that can be called to query MaxMind's GeoLite2 IP address database, please refer to the documentation for GeoLite2PP::DB. For example:
API | Description |
---|---|
GeoLite2PP::DB | Class to talk to the GeoLite2 database. |
GeoLite2PP::DB::DB() | Constructor to gain access to the database. |
GeoLite2PP::DB::lookup() | Look up an IP address and return all the information as a JSON string. |
GeoLite2PP::DB::get_all_fields() | Look up an IP address and return a std::map of many fields. |