我们正在使用geolitectyv6检测产品中的ipv6地址。
然而,我们发现国家/地区/城市数据无法从数据库中获得,而国家数据是可用的。
例如,在解析IP地址2a02:2b88:2:1::419a:1时,我们得到Country=捷克共和国,但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

所以我的问题是,geolitectyv6.dat没有地区/城市的相关数据,还是我们误用了错误的API?
非常感谢!

最佳答案

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

09-29 23:15