func DoLookup() { conn := pool.Get() defer conn.Close() q := internet.NewIP2ASNClient(conn) q2 := internet.NewASN2ASDescClient(conn) for _, i := range []string{"8.8.8.8", "5.150.255.150", "127.0.0.1"} { res, err := q.Current(i) if err != nil { panic(err) } log.Printf("current : %s: %s ", i, res) if res != nil { cur, err := q2.Current(res.ASN) if err != nil { panic(err) } log.Printf("desc : %s", cur) } log.Printf("allhistory: %s", i) allhist, err := q.AllHistory(i) if err != nil { panic(err) } for _, v := range allhist { log.Println(v.String()) } } }
func (i *Internet) IP2ASN(IP net.IP) (*internet.ASNResult, error) { rconn := i.Get() r, e := internet.NewIP2ASNClient(rconn).Current(IP.String()) rconn.Close() return r, e }