oschwald / maxminddb-golang

MaxMind DB Reader for Go
ISC License
586 stars 99 forks source link

geoip.City() returns a half-empty object with the specified IP address #145

Closed groall closed 1 month ago

groall commented 2 months ago
ip := "185.76.254.54"
city, err := geoip.City(net.ParseIP(ip))

both city.City.Name and city.City.GeoNameID are empty, but other properties such as Continent or Country are filled.

I'm using the latest maxdb update. And if I convert the database to csv, then the csv will have complete information about the city - name, id, etc.

I have the problem only with the IP address from the example.

oschwald commented 1 month ago

It appears that the database doesn't have city-level data for that IP address. Not all IPs are geolocated to a city.

groall commented 1 month ago

@oschwald sorry, maybe I misunderstand the results for this IP at https://www.maxmind.com/en/geoip-web-services-demo - there is a complete location with region and city: Selection_437 I was hoping I could get the same information using maxminddb-golang

oschwald commented 1 month ago

That is a demo for MaxMind's web service, which has more precise data. You don't mention which database you are using, but the latest GeoLite database does not have city-level data for that IP.

I'd suggest directing data questions to MaxMind's support.