check / check (push) Canceled after 0s
make asupdate piped the generator into gzip, so the target saw gzip's exit status. A failed download replaced pkg/asinfo/asdata.json.gz with an empty file and the target still exited 0. The target now runs the new script/asupdate. It writes the generator's output to a temporary file and checks that the generator succeeded and wrote at least one AS. Only then does it compress the list and move it into place. Otherwise it leaves the file alone and exits non-zero. The generator reads as.csv from ipverse/as-metadata, the source's new name. The list it builds there is unchanged, so no new list is committed. Model: opus-5-5
31 lines
997 B
Go
31 lines
997 B
Go
/*
|
|
Package asinfo provides information about Autonomous Systems (AS).
|
|
|
|
The package embeds a comprehensive database of AS numbers, handles, and descriptions
|
|
sourced from https://github.com/ipverse/as-metadata. The data is embedded at compile
|
|
time and provides fast, offline lookups.
|
|
|
|
Basic usage:
|
|
|
|
// Get information about an AS
|
|
info, ok := asinfo.Get(15169)
|
|
if ok {
|
|
fmt.Printf("AS%d: %s - %s\n", info.ASN, info.Handle, info.Description)
|
|
}
|
|
|
|
// Get just the description
|
|
desc := asinfo.GetDescription(15169) // "Google LLC"
|
|
|
|
// Search the handles and descriptions, ignoring case, for the first 10
|
|
// matches in AS number order and the number of all matches
|
|
results, total := asinfo.Search("university", 10)
|
|
fmt.Printf("%d matches\n", total)
|
|
for _, as := range results {
|
|
fmt.Printf("AS%d: %s\n", as.ASN, as.Description)
|
|
}
|
|
|
|
The data is loaded lazily on first access and cached in memory for the lifetime
|
|
of the program. All getter methods are safe for concurrent use.
|
|
*/
|
|
package asinfo
|