go get github.com/ges-sh/ipapi
package main
import (
"fmt"
"net"
"github.com/ges-sh/ipapi"
)
func main() {
client, _ := ipapi.New("en")
ipLoc, _ := client.FetchIPLocation(net.ParseIP("24.48.0.1"))
fmt.Printf("%+v\n", ipLoc) // {Query:24.48.0.1 Status:success Message: Country:Canada CountryCode:CA Region:QC RegionName:Quebec City:Vaudreuil-Dorion Zip:H9X Lat:45.4 Lon:-73.9333 Timezone:America/Toronto ISP:Le Groupe Videotron Ltee Org:Videotron Ltee AS:AS5769 Videotron Telecom Ltee}
}
...
ipLoc, _ := client.FetchIPLocationStr("24.48.0.1")
fmt.Printf("%+v\n", ipLoc) // {Query:24.48.0.1 Status:success Message: Country:Canada CountryCode:CA Region:QC RegionName:Quebec City:Vaudreuil-Dorion Zip:H9X Lat:45.4 Lon:-73.9333 Timezone:America/Toronto ISP:Le Groupe Videotron Ltee Org:Videotron Ltee AS:AS5769 Videotron Telecom Ltee}
}
client.Pro("your_api_key")