mirror of
https://github.com/skidoodle/ipinfo.git
synced 2026-04-28 01:27:34 +02:00
Update readme
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user