ip-location-rs is a RESTful batteries-included IP information lookup microservice made with Rust. It’s designed for high performance, easy deployment, and minimal dependencies.
We provide a docker image at DockerHub
docker run -d -p 8000:8000 neeythann/ip-location-rs
A sample ArgoCD Kubernetes application, deployment, and service manifests can be found in the manifests/
folder.
To build the project from source, you'll need Rust and cargo installed.
git clone https://github.com/neeythann/ip-location-rs.git
cd ip-location-rs
cargo build --release
For more information, please see the openapi.yaml file spec
GET /
- returns a JSON response containing the current user's IP address AS and country details
GET /ip/{ip_address}
- returns a JSON response containing the requested IP address AS and country details
GET /AS/{asn_number}
- returns a JSON response containing the ASN's details and associated networks
GET /country/{country_code}
- returns a JSON response containing the country details and associated networks
curl -s http://localhost:80/ -H 'X-Forwarded-For: 1.1.1.1' | jq
Which outputs:
{
"ip": "1.1.1.1",
"country": {
"country_code": "AU"
},
"asn": {
"autonomous_system_number": 13335,
"autonomous_system_organization": "Cloudflare, Inc.",
"license": "CC BY 4.0 by RouteViews and DB-IP",
"modifications": "https://github.com/sapics/ip-location-db/blob/main/asn/MODIFICATIONS"
}
}
This service uses RouteViews and DB-IP MMDB files for geolocation, which are licensed under the Creative Commons Attribution 4.0 International License (CC BY 4.0).
You may download the databases from https://github.com/sapics/ip-location-db/tree/main/asn/ or see the run.sh
file
This repository is licensed under the MIT license - see the LICENSE file for more details.