A JSON REST api for the popular Maxmind geoip database
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
.gitignore
.travis.yml
LICENSE
README.md
pom.xml
release.sh

README.md

IP Geolocation REST API

travis-ci

This project provides a simple web service which returns geolocation information for a given IP address.

The service loads location information from Maxmind's GeoIP2 City (commercial) or GeoLite2 database; and ISP information from Maxmind's GeoIP2 ISP database.

The database files are not included in this project. The location of the files can be specified using environment variables:

Variable Description Default value
CITY_DB_FILE The location of the GeoIP2 City or GeoLite2 database file. /srv/GeoLite2-City.mmdb
ISP_DB_FILE The location of the GeoIP2 ISP database file. (none)

At least one of the database files must be provided.

Running the container

docker run -p 8080:8080 \
    -v /path/to/GeoLite2-City.mmdb:/srv/GeoLite2-City.mmdb \
    shopping24/geoip-api

Using the API

When the container is running, you can query it via simple HTTP GET requests:

curl http://localhost:8080/8.8.8.8
{
    "country":"US",
    "latitude":"37.751",
    "longitude":"-97.822"
}

Building the project

Build the container image by calling:

mvn clean verify

Contributing

We're looking forward to your comments, issues and pull requests!

License

This project is licensed under the Apache License, Version 2.