Exposing IP geolocation data from local databases via HTTP
Note
Only IPv4 addresses are supported for now.
Note
This section demonstrates using the herrbischoff/country-ip-blocks database. See the full list of supported databases for other sources.
First clone the herrbischoff/country-ip-blocks repository anywhere in the filesystem. Then run from this repository:
cargo run --release -- --herrbischoff-path /path/to/country-ip-blocks-repo/ipgeod will listen on port 3000 (configurable via --port). Test the API with:
curl http://localhost:3000/ipv4/1.2.3.4The following databases are supported:
-
herrbischoff/country-ip-blocks
To use this database, simply clone the repository anywhere in the filesystem, and set
--herrbischoff-path(or theHERRBISCHOFF_PATHenvironment variable) to the path. -
Download the CSV version of the
DB1.LITEdatabase (codeDB1LITECSV), and set--ip2location-db(or theIP2LOCATION_DBenvironment variable) to the file path.
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.