https://github.com/stefansundin/maxmind-geoip-api
A tiny service that performs MaxMind GeoIP database lookups.
https://github.com/stefansundin/maxmind-geoip-api
Last synced: 4 months ago
JSON representation
A tiny service that performs MaxMind GeoIP database lookups.
- Host: GitHub
- URL: https://github.com/stefansundin/maxmind-geoip-api
- Owner: stefansundin
- License: mit
- Created: 2024-04-02T06:33:52.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-08T14:25:38.000Z (7 months ago)
- Last Synced: 2025-03-08T15:26:40.556Z (7 months ago)
- Language: Rust
- Homepage:
- Size: 80.1 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
This is a tiny MaxMind GeoIP API, written in rust for minimal resource usage. The docker image comes in at less than 5 MB uncompressed. This makes it convenient to run as a sidecar container.
You simply need to configure `MAXMIND_DB_URL` with a URL that has your database and run the program. Then query the API by putting the desired IP address in the path, e.g. http://localhost:3000/1.2.3.4. Get the database metadata from http://localhost:3000/metadata.
The program can automatically decompress archives of the formats `.zip`, `.tar`, `.gz`, `.bz2`, `.xz`, and `.zst`. It will check if there's a new database update every 24 hours. Update checks use the `ETag` header from the previous download to avoid downloading the file again if there isn't a new version available.
See the [examples](examples) directory to get started.
## Docker image
The docker image is available on [Docker Hub](https://hub.docker.com/r/stefansundin/maxmind-geoip-api) and [Amazon ECR](https://gallery.ecr.aws/stefansundin/maxmind-geoip-api).
```
stefansundin/maxmind-geoip-api:v1
``````
public.ecr.aws/stefansundin/maxmind-geoip-api:v1
```## SIGHUP
If you want to force a database update check then send the program a SIGHUP signal:
```shell
docker ps
docker kill --signal=HUP container_id# if you are using docker compose:
docker compose kill --signal=HUP geoip
```## Development
```shell
export RUST_LOG=maxmind_geoip_api=debug
export DATA_DIR=$PWD/data
export MAXMIND_DB_URL=https://example.com/GeoLite2-City.mmdb
cargo run
```