Add /api/v1/ip/<ip> endpoint for IP to AS lookups

- Add handleIPLookup handler that uses GetASInfoForIP
- Create writeJSONError and writeJSONSuccess helper functions
- Refactor all JSON error responses to use the helpers
- Add GetASInfoForIP to Store interface
- Add mock implementation for tests
- Fix all linter warnings
This commit is contained in:
2025-07-28 03:31:53 +02:00
parent afb916036c
commit 691710bc7c
3 changed files with 67 additions and 30 deletions

View File

@@ -44,6 +44,9 @@ type Store interface {
GetPrefixDistribution() (ipv4 []PrefixDistribution, ipv6 []PrefixDistribution, err error)
GetLiveRouteCounts() (ipv4Count, ipv6Count int, err error)
// IP lookup operations
GetASInfoForIP(ip string) (*ASInfo, error)
// Lifecycle
Close() error
}