-
Notifications
You must be signed in to change notification settings - Fork 0
/
doc.go
45 lines (37 loc) · 967 Bytes
/
doc.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/*
# IP to ASN Mapping Service
https://team-cymru.com/community-services/ip-asn-mapping
This Go Module supports bulk queries to the Team Cymru IP ASN Mapping Service.
Example:
package main
import (
"context"
"log"
"github.com/chrispassas/ipasn"
)
func main() {
log.SetFlags(log.Ldate | log.Lmicroseconds | log.Lshortfile)
var values = []string{
"1.1.1.0/24",
"8.8.8.8",
"9.9.9.9",
"AS13335",
"2001:0db8:85a3:0000:0000:8a2e:0370:7334",
}
var results []ipasn.Result
var err error
if results, err = ipasn.BulkSearch(context.Background(), values); err != nil {
log.Fatalf("ipasn.Search() error:%v", err)
}
for _, r := range results {
log.Printf("----------------------")
log.Printf("asn:%d", r.ASN)
log.Printf("asname:%s", r.ASName)
log.Printf("allocated:%s", r.Allocated)
log.Printf("prefix:%s", r.BGPPrefix)
log.Printf("cc:%s", r.CC)
log.Printf("registry:%s", r.Registry)
}
}
*/
package ipasn