Add route age information to IP lookup API
- Add last_updated timestamp and age fields to ASInfo - Include route's last_updated time from live_routes table - Calculate and display age as human-readable duration - Update both IPv4 and IPv6 queries to fetch timestamp - Fix error handling to return 400 for invalid IPs
This commit is contained in:
@@ -190,11 +190,14 @@ func (m *mockStore) GetLiveRouteCounts() (ipv4Count, ipv6Count int, err error) {
|
||||
// GetASInfoForIP mock implementation
|
||||
func (m *mockStore) GetASInfoForIP(ip string) (*database.ASInfo, error) {
|
||||
// Simple mock - return a test AS
|
||||
now := time.Now()
|
||||
return &database.ASInfo{
|
||||
ASN: 15169,
|
||||
Handle: "GOOGLE",
|
||||
Description: "Google LLC",
|
||||
Prefix: "8.8.8.0/24",
|
||||
LastUpdated: now.Add(-5 * time.Minute),
|
||||
Age: "5m0s",
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user