Browse Source

geo ip fix

master
gsd 2 weeks ago
parent
commit
562488893a
  1. 1
      src/main/java/app/services/io/readers/GeoIPCity.java
  2. 1
      src/main/java/app/services/io/readers/GeoIPCountry.java

1
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);

1
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");

Loading…
Cancel
Save