geoip-api/README.md

26 lines
400 B
Markdown

# geoip-api
HTTP API for converting an IPv4 address to a country code.
Uses the [`iptoasn.com`](https://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
```shell
$ http GET 'http://127.0.0.1:8000/192.168.0.1'
```
```json
{
"asn": 0,
"country_code": "None",
"asn_desc": "Not routed"
}
```