https://github.com/extrawurst/ip2country
fast ip -> country lookup using asn database
https://github.com/extrawurst/ip2country
docker iplookup rust webservice
Last synced: over 1 year ago
JSON representation
fast ip -> country lookup using asn database
- Host: GitHub
- URL: https://github.com/extrawurst/ip2country
- Owner: extrawurst
- License: mit
- Created: 2020-06-30T19:19:43.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2024-01-05T10:38:23.000Z (over 2 years ago)
- Last Synced: 2024-05-01T19:46:48.601Z (about 2 years ago)
- Topics: docker, iplookup, rust, webservice
- Language: Rust
- Homepage: https://hub.docker.com/repository/docker/extrawurst/ip2country
- Size: 4.8 MB
- Stars: 68
- Watchers: 4
- Forks: 14
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
Awesome Lists containing this project
README
# ip2country

uses free (CC0) APNs lookup [tables](https://github.com/sapics/ip-location-db) for ip to country lookup based on [OpenGeoFeed.com](https://opengeofeed.org).
find the docker image on [docker hub](https://hub.docker.com/repository/docker/extrawurst/ip2country).
# features
* lightweight and fast using rust
* supports **ipv4** and **ipv6**
* free APNs tables, no license mess
* nightly updated with fresh APNs tables
* use via REST or gRPC
# REST example
use REST service:
```
docker run -d --rm --name ip2country -p 5000:5000 extrawurst/ip2country:latest
curl http://0.0.0.0:5000/2a00:1450:4005:800::200e
US
curl http://0.0.0.0:5000/172.217.16.78
US
docker kill ip2country
```
use `PORT` env variable to change the default port (5000):
```
docker run -p 9000:9000 -e PORT=9000 extrawurst/ip2country
```
# gRPC example
Find grpc proto definition here:
[ip2country-grpc/proto/ip2c.proto](./ip2country-grpc/proto/ip2c.proto)
use gRPC service:
```
docker run -d --rm --name ip2country -p 50051:50051 extrawurst/ip2country-grpc:latest
docker kill ip2country
```
use `SRV_ADDR` env variable to change the services address:
```
docker run -p 9000:9000 -e SRV_ADDR=0.0.0.0:9000 extrawurst/ip2country
```