diff --git a/src/main/java/app/services/io/readers/GeoIPCity.java b/src/main/java/app/services/io/readers/GeoIPCity.java index 0d3f07a..2b28b50 100644 --- a/src/main/java/app/services/io/readers/GeoIPCity.java +++ b/src/main/java/app/services/io/readers/GeoIPCity.java @@ -26,6 +26,7 @@ public class GeoIPCity extends BaseReader { public String GetCity(String ip) { try { + if (ip == null || ip.isEmpty() || ip.startsWith("10.") || ip.startsWith("127.") || ip.startsWith("192.168")) return "Unknown"; return databaseReader.city(InetAddress.getByName(ip)).getCity().getName(); } catch (Exception e) { logger.error("[IGNORING] Cannot fetch city of ip", e); diff --git a/src/main/java/app/services/io/readers/GeoIPCountry.java b/src/main/java/app/services/io/readers/GeoIPCountry.java index 405d2ae..c10c33b 100644 --- a/src/main/java/app/services/io/readers/GeoIPCountry.java +++ b/src/main/java/app/services/io/readers/GeoIPCountry.java @@ -26,6 +26,7 @@ public class GeoIPCountry extends BaseReader { public String GetCountry(String ip) { try { + if (ip == null || ip.isEmpty() || ip.startsWith("10.") || ip.startsWith("127.") || ip.startsWith("192.168")) return "Unknown"; return databaseReader.country(InetAddress.getByName(ip)).getCountry().getName(); } catch (Exception e) { logger.error("[IGNORING] Cannot fetch country of ip");