geoip-rs
geoip-rs is a geoip service: it provides geographical information about the calling or the specified IP address. It supports both IPV4 and IPV6.
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.
By default, responses will be in english. An optional lang
query param can be provided: if a translation is available, returned data will be in that language. Current list includes: de
, en
, es
, fr
, ja
, pt-BR
, ru
, zh-CH
.
Example response
Valid ip address:
Not found (private) ip address:
Speed
On an 8 cores Intel i7, geoip.rs can serve ~35K requests/sec.
Dataset
geoip-rs uses the free dataset provided by maxmind. They are not bundled: you have to download it separately.
Download "GeoLite2 City" dataset in binary format from here and unzip it.
Running
Install geoip.rs with cargo install geoip-rs
. If you don't know what cargo
is, read the tutorial.
You can specify the dataset location on the command line
or via environment variable
You can also customize the host and port geoip.rs will listen to
License
This project is licensed under the Apache License, Version 2.0