geoip-rs
geoip-rs is a geoip service: it provides geographical information about the calling or the specified IP address.
When called with no query params, it resolves the calling IP address. For example: https://api.geoip.rs
When called with the ip
query param, it resolves the specified IP address. For example: https://api.geoip.rs/?ip=216.58.205.132
If the provided IP address is invalid, it falls back to the calling IP address.
Example response
Speed
On an 8 cores Intel i7, geoip.rs can serve between ~20K and ~50K requests/sec, depending on the requested ip address.
Running
Once built with cargo build --release
, run it with ./target/release/geoip-rs
. By default the english location dataset is loaded.
You can specify different datasets as command line arguments, for example
or environment variables, for example
Datasets
geoip-rs uses the free datasets provided by maxmind. They are not bundled: you have to download them separately.
Download "GeoLite2 City" dataset in CSV format from here and unzip it into the data
folder.
License
This project is licensed under the Apache License, Version 2.0