Go to file
sneak 08ca75966e Fix dependency injection and implement proper CIDR checking
- 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
2025-07-27 18:44:53 +02:00
bin Fix dependency injection and implement proper CIDR checking 2025-07-27 18:44:53 +02:00
cmd/ipapi Implement IP API daemon with GeoIP database support 2025-07-27 18:15:38 +02:00
internal Fix dependency injection and implement proper CIDR checking 2025-07-27 18:44:53 +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