|
|
@ -29,15 +29,15 @@ public class GeoIP extends BaseReader { |
|
|
public String GetCountry(String ip) { |
|
|
public String GetCountry(String ip) { |
|
|
try { |
|
|
try { |
|
|
return databaseReader.country(InetAddress.getByName(ip)).getCountry().getName(); |
|
|
return databaseReader.country(InetAddress.getByName(ip)).getCountry().getName(); |
|
|
} catch (GeoIp2Exception | IOException e) { |
|
|
} catch (Exception e) { |
|
|
return "Unknown"; |
|
|
return "Unknown"; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public String GetCity(String ip) { |
|
|
public String GetCity(String ip) { |
|
|
try { |
|
|
try { |
|
|
return databaseReader.city(InetAddress.getByName(ip)).getCountry().getName(); |
|
|
return databaseReader.city(InetAddress.getByName(ip)).getCity().getName(); |
|
|
} catch (GeoIp2Exception | IOException e) { |
|
|
} catch (Exception e) { |
|
|
return "Unknown"; |
|
|
return "Unknown"; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|