GeoLiteCityv6.dat中是否包含城市和地区数据?

时间:2016-04-15 09:12:53

标签: c ipv6 geoip maxmind

我们正在使用GeoLiteCityv6检测我们产品中的ipv6地址。 但是,我们发现无法从数据库中获取州/地区/城市数据,而国家数据可用。

E.g。当解析IP地址2a02:2b88:2:1 :: 419a:1时我们得到Country = Czech Republic,但Region为空,city也为空。我们检查了几个IP地址,但未获得任何地区/城市信息。

我们正在使用C API进行开发,我们使用的API如下所示:

GeoIPRecord *gir = GeoIP_record_by_addr_v6(gi, ip);
char *state = (char *)GeoIP_region_name_by_code(gir->country_code, gir->region);
printf("DB: state is %s.\n", state);         //return NULL
printf("DB: continent_code is %s.\n", gir->continent_code);  //right
printf("DB: country name is %s.\n", gir->country_name);  //right
printf("DB: country code is %s.\n", gir->country_code);  //right
printf("DB: region is %s.\n", gir->region);  //return NULL
printf("DB: city is %s.\n", gir->city);     //return NULL

所以我的问题是,GeoLiteCityv6.dat是否没有区域/城市的相关数据,或者我们误用了错误的API?

非常感谢!

1 个答案:

答案 0 :(得分:0)

不,它没有城市级别的信息,尽管它的名字。只需以csv格式下载相同的文件并打开它。没有城市级信息。