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() {
	results := asinfo.Search("MIT-GATEWAY")
	for _, info := range results {
		fmt.Printf("AS%d: %s - %s\n", info.ASN, info.Handle, info.Description)
	}
	// Output: AS3: MIT-GATEWAYS - Massachusetts Institute of Technology
}
