mirror of
https://github.com/skidoodle/ipinfo.git
synced 2026-04-28 17:37:37 +02:00
Update readme
This commit is contained in:
@@ -26,12 +26,11 @@ type DataStruct struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ASNDataResponse struct {
|
type ASNDataResponse struct {
|
||||||
ASNDetails ASNDetails `json:"asn_details"`
|
Details Details `json:"details"`
|
||||||
Prefixes PrefixInfo `json:"prefixes"`
|
Prefixes PrefixInfo `json:"prefixes"`
|
||||||
SourceDetails SourceDetails `json:"source_details"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type ASNDetails struct {
|
type Details struct {
|
||||||
ASN uint `json:"asn"`
|
ASN uint `json:"asn"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
}
|
}
|
||||||
@@ -41,10 +40,6 @@ type PrefixInfo struct {
|
|||||||
IPv6 []string `json:"ipv6"`
|
IPv6 []string `json:"ipv6"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type SourceDetails struct {
|
|
||||||
Source string `json:"source"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// Global caches with 10 minute TTL
|
// Global caches with 10 minute TTL
|
||||||
var ipCache = NewIPCache(10 * time.Minute)
|
var ipCache = NewIPCache(10 * time.Minute)
|
||||||
var asnCache = NewASNCache(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)
|
sort.Strings(ipv6Prefixes)
|
||||||
|
|
||||||
response := &ASNDataResponse{
|
response := &ASNDataResponse{
|
||||||
ASNDetails: ASNDetails{
|
Details: Details{
|
||||||
ASN: targetASN,
|
ASN: targetASN,
|
||||||
Name: orgName,
|
Name: orgName,
|
||||||
},
|
},
|
||||||
@@ -222,9 +217,6 @@ func LookupASNData(geoIP *db.GeoIPManager, targetASN uint) (*ASNDataResponse, er
|
|||||||
IPv4: ipv4Prefixes,
|
IPv4: ipv4Prefixes,
|
||||||
IPv6: ipv6Prefixes,
|
IPv6: ipv6Prefixes,
|
||||||
},
|
},
|
||||||
SourceDetails: SourceDetails{
|
|
||||||
Source: "GeoLite2-ASN.mmdb",
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
asnCache.Set(targetASN, response)
|
asnCache.Set(targetASN, response)
|
||||||
|
|||||||
@@ -38,6 +38,39 @@ $ curl https://ip.albert.lol/9.9.9.9/city
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Get details about an ASN
|
||||||
|
```sh
|
||||||
|
$ curl https://ip.albert.lol/AS13335
|
||||||
|
{
|
||||||
|
"details": {
|
||||||
|
"asn": 19281,
|
||||||
|
"name": "QUAD9-AS-1"
|
||||||
|
},
|
||||||
|
"prefixes": {
|
||||||
|
"ipv4": [
|
||||||
|
"149.112.112.0/24",
|
||||||
|
"149.112.149.0/24",
|
||||||
|
"199.249.255.0/24",
|
||||||
|
"9.9.9.0/24"
|
||||||
|
],
|
||||||
|
"ipv6": [
|
||||||
|
"2001:0:909:900::/56",
|
||||||
|
"2001:0:9570:7000::/56",
|
||||||
|
"2001:0:9570:9500::/56",
|
||||||
|
"2001:0:c7f9:ff00::/56",
|
||||||
|
"2002:909:900::/40",
|
||||||
|
"2002:9570:7000::/40",
|
||||||
|
"2002:9570:9500::/40",
|
||||||
|
"2002:c7f9:ff00::/40",
|
||||||
|
"2620:fe::/48",
|
||||||
|
"::909:900/120",
|
||||||
|
"::9570:7000/120",
|
||||||
|
"::9570:9500/120",
|
||||||
|
"::c7f9:ff00/120"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
## Running Locally
|
## Running Locally
|
||||||
|
|
||||||
### With Docker
|
### With Docker
|
||||||
|
|||||||
Reference in New Issue
Block a user