Single file library for Kealper's geoip utility written in Golang without extra dependencies
go get github.com/JoshuaDoes/goeip
package main
import "fmt"
import "github.com/JoshuaDoes/goeip"
func main() {
result, err := goeip.Lookup("joshuadoes.com")
if err != nil {
fmt.Println("Error: " + fmt.Sprintf("%v", err))
return
}
if result.Error > 0 {
fmt.Println("Lookup error: " + result.Details)
}
fmt.Println("City: " + result.City)
fmt.Println("State: " + result.State)
}
> go run main.go
City: Dallas
State: Texas