Skip to content

Go SDK

Go module

There is no extra registry. go get uses the GitHub module.

Terminal window
go get github.com/lavrox/SDK-IPWho-IP-Geolocation-Go

Go 1.21+. Stdlib only.

client, err := ipwho.NewClient(os.Getenv("IPWHO_API_KEY"))
resp, err := client.Lookup("8.8.8.8", nil) // GET /ip/{ip}
me, err := client.Me(nil) // GET /me
bulk, err := client.Bulk([]string{"8.8.8.8", "1.1.1.1"}, nil) // []IpGeoResponse

Optional JSON fields are pointers — check before dereference.

fmt.Println(*resp.Data.GeoLocation.Country) // United States