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
This commit is contained in:
2025-07-27 18:44:53 +02:00
parent 2a1710cca8
commit 08ca75966e
9 changed files with 446 additions and 78 deletions

View File

@@ -25,7 +25,7 @@ const (
cityFile = "GeoLite2-City.mmdb"
countryFile = "GeoLite2-Country.mmdb"
downloadTimeout = 5 * time.Minute
downloadTimeout = 30 * time.Second
updateInterval = 7 * 24 * time.Hour // 1 week
defaultDirPermissions = 0750