geoip2

Query by city name on geolite2 .mmdb file (JAVA)

狂风中的少年 提交于 2021-01-27 17:02:01
问题 I am using GeoLite2 to get Location by IP address for my java appliccation. I want to get country by city from GeoLite2-City.mmdb file. This is my reader : DatabaseReader reader = new DatabaseReader.Builder(dbFileStream).withCache(new CHMCache()).build(); I am getting CityResponse by IP address like below : CityResponse cityResponse = reader.city(InetAddress.getByName("an IP address")); But I want to get Country name by city like this : String countryName = reader.getCountryByCity("Paris”);

Maxmind GeoIP2 tutorial (How-to)?

▼魔方 西西 提交于 2019-12-10 11:12:52
问题 I used GeoIp, with pure PHP codes.. but GeoIp2 become namespaced and etc, and at this moment i couldnt find out how to use that.. i have downloaded GeoLite2-Country.mmdb , and now how to get the country name for IP, i.e. 123.123.123.123 . p.s. I dont have GIT/COMPOSER or etc.. 回答1: How i did it: let's say, create a folder named " My_Folder " and inside it: 1) create folder GeoIp2 and put in it content of this "SRC" folder (download). 2) put MaxMind folder (download, from "SRC" folder). 3)