package asinfo_test import ( "fmt" "git.eeqj.de/sneak/routewatch/pkg/asinfo" ) func ExampleGet() { info, ok := asinfo.Get(15169) if ok { fmt.Printf("AS%d: %s - %s\n", info.ASN, info.Handle, info.Description) } // Output: AS15169: GOOGLE - Google LLC } func ExampleGetDescription() { desc := asinfo.GetDescription(13335) fmt.Println(desc) // Output: Cloudflare Inc. } func ExampleSearch() { const limit = 10 results, total := asinfo.Search("mit-gateway", limit) fmt.Printf("%d of %d matches\n", len(results), total) for _, info := range results { fmt.Printf("AS%d: %s - %s\n", info.ASN, info.Handle, info.Description) } // Output: // 1 of 1 matches // AS3: MIT-GATEWAYS - Massachusetts Institute of Technology }