Go to file
sneak 2a1710cca8 Implement IP API daemon with GeoIP database support
- Create modular architecture with separate packages for config, database, HTTP, logging, and state management
- Implement Cobra CLI with daemon command
- Set up Uber FX dependency injection
- Add Chi router with health check and IP lookup endpoints
- Implement GeoIP database downloader with automatic updates
- Add state persistence for tracking database download times
- Include comprehensive test coverage for all components
- Configure structured logging with slog
- Add Makefile with test, lint, and build targets
- Support both IPv4 and IPv6 lookups
- Return country, city, ASN, and location data in JSON format
2025-07-27 18:15:38 +02:00
cmd/ipapi Implement IP API daemon with GeoIP database support 2025-07-27 18:15:38 +02:00
internal Implement IP API daemon with GeoIP database support 2025-07-27 18:15:38 +02:00
.golangci.yml Implement IP API daemon with GeoIP database support 2025-07-27 18:15:38 +02:00
AGENTS.md Implement IP API daemon with GeoIP database support 2025-07-27 18:15:38 +02:00
CLAUDE.md Implement IP API daemon with GeoIP database support 2025-07-27 18:15:38 +02:00
go.mod Implement IP API daemon with GeoIP database support 2025-07-27 18:15:38 +02:00
go.sum Implement IP API daemon with GeoIP database support 2025-07-27 18:15:38 +02:00
Makefile Implement IP API daemon with GeoIP database support 2025-07-27 18:15:38 +02:00
README.md Implement IP API daemon with GeoIP database support 2025-07-27 18:15:38 +02:00

ipapi

IP API is a simple IP information REST api designed for self-hosting.

On initial startup, it fetches:

It then provides a simple REST api at:

http://example.com:8080/api/

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