diff --git a/geoip.go b/geoip.go index 43b1d14..17227bb 100644 --- a/geoip.go +++ b/geoip.go @@ -105,6 +105,10 @@ func geohashAndLocationFromMaxMindDb(address string) (string, string, string, er // If you are using strings that may be invalid, check that ip is not nil ip := net.ParseIP(address) record, err := db.City(ip) + if err != nil { + // In case of using Country DB, city is not available. + record, err = db.Country(ip) + } if err != nil { return "s000", "Unknown", "Unknown", err }