Update readme

This commit is contained in:
2025-07-31 19:22:28 +02:00
parent dfec9ba602
commit 1f22b9f898
2 changed files with 37 additions and 12 deletions
+4 -12
View File
@@ -26,12 +26,11 @@ type DataStruct struct {
}
type ASNDataResponse struct {
ASNDetails ASNDetails `json:"asn_details"`
Prefixes PrefixInfo `json:"prefixes"`
SourceDetails SourceDetails `json:"source_details"`
Details Details `json:"details"`
Prefixes PrefixInfo `json:"prefixes"`
}
type ASNDetails struct {
type Details struct {
ASN uint `json:"asn"`
Name string `json:"name"`
}
@@ -41,10 +40,6 @@ type PrefixInfo struct {
IPv6 []string `json:"ipv6"`
}
type SourceDetails struct {
Source string `json:"source"`
}
// Global caches with 10 minute TTL
var ipCache = NewIPCache(10 * time.Minute)
var asnCache = NewASNCache(10 * time.Minute)
@@ -214,7 +209,7 @@ func LookupASNData(geoIP *db.GeoIPManager, targetASN uint) (*ASNDataResponse, er
sort.Strings(ipv6Prefixes)
response := &ASNDataResponse{
ASNDetails: ASNDetails{
Details: Details{
ASN: targetASN,
Name: orgName,
},
@@ -222,9 +217,6 @@ func LookupASNData(geoIP *db.GeoIPManager, targetASN uint) (*ASNDataResponse, er
IPv4: ipv4Prefixes,
IPv6: ipv6Prefixes,
},
SourceDetails: SourceDetails{
Source: "GeoLite2-ASN.mmdb",
},
}
asnCache.Set(targetASN, response)