- Add http module for proper FX dependency injection - Fix router to accept state manager parameter - Implement proper CIDR-based checking for RFC1918 and documentation IPs - Add reasonable timeouts (30s) for database downloads - Update tests to download databases to temporary directories - Add tests for multiple IP lookups and error cases - All tests passing |
||
---|---|---|
bin | ||
cmd/ipapi | ||
internal | ||
.golangci.yml | ||
AGENTS.md | ||
CLAUDE.md | ||
go.mod | ||
go.sum | ||
Makefile | ||
README.md |
ipapi
IP API is a simple IP information REST api designed for self-hosting.
On initial startup, it fetches:
- https://git.io/GeoLite2-ASN.mmdb
- https://git.io/GeoLite2-City.mmdb
- https://git.io/GeoLite2-Country.mmdb
It then provides a simple REST api at:
It supports IPv4 and IPv6.
It has a state file at /var/lib/ipapi/daemon.json that keeps track of the last download times of the databases, and it replaces them if they are older than 1 week (or, of course, if they are missing).
Usage
curl https://ipapi.example.com/api/8.8.8.8
Libraries
- go stdlib log/slog
- cobra cli
- uber/fx DI
- go-chi/chi router