Convert an IPv4 address to a country code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Charlotte Som 300b827915 Hook up the range data to the API 4 weeks ago
data Parse ip2asn data 4 weeks ago
src Hook up the range data to the API 4 weeks ago
.editorconfig Parse ip2asn data 4 weeks ago
.gitignore Initial commit: Cargo template 4 weeks ago
Cargo.lock Hook up the range data to the API 4 weeks ago
Cargo.toml Hook up the range data to the API 4 weeks ago
README.md Parse ip2asn data 4 weeks ago

README.md

geoip-api

HTTP API for converting an IPv4 address to a country code.

Uses the iptoasn.com dataset.

Setup

Grab the latest ip2asn-v4.tsv.gz and extract it to data/ip2asn-v4.tsv.

Then just use cargo as usual.

Usage

$ http GET 'http://127.0.0.1:8000/192.168.0.1'
{
  "asn": 0,
  "country_code": "None",
  "asn_desc": "Not routed"
}