Go SDK
The IPWho Go SDK wraps the IP geolocation API in idiomatic Go — typed structs with pointer-based optional fields, standard-library HTTP, and no extra registry. One call returns the full payload: geolocation, timezone, currency, connection (ASN/ISP), security flags, and more.
- Source / module: github.com/lavrox/SDK-IPWho-IP-Geolocation-Go
- API key: ipwho.org/free-plan
Installation
Section titled “Installation”go get github.com/lavrox/SDK-IPWho-IP-Geolocation-GoGo 1.21+. Stdlib only.
Quick start
Section titled “Quick start”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 /mebulk, err := client.Bulk([]string{"8.8.8.8", "1.1.1.1"}, nil) // []IpGeoResponseOptional JSON fields are pointers — check before dereference.
fmt.Println(*resp.Data.GeoLocation.Country) // United StatesError handling
Section titled “Error handling”resp, err := client.Lookup("8.8.8.8", nil)if err != nil { var invalidErr *ipwho.InvalidIPError var rateErr *ipwho.RateLimitError switch { case errors.As(err, &invalidErr): // malformed IP address (404) case errors.As(err, &rateErr): // plan limit reached (429) default: // APIResponseError or other }}Methods
Section titled “Methods”Lookup(ip string, opts *LookupOptions) (*IpGeoResponse, error)—GET /ip/{ip}Me(opts *MeOptions) (*IpGeoResponse, error)—GET /meBulk(ips []string, opts *BulkOptions) ([]IpGeoResponse, error)—GET /bulk/{a,b,c}