Browse Source

cc 2.5

master
gsd 1 week ago
parent
commit
4d0149327f
  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

@ -27,6 +27,7 @@ public class GeoIPCity extends BaseReader {
public String GetCity(String ip) { public String GetCity(String ip) {
try { try {
if (ip == null || ip.isEmpty() || ip.startsWith("10.") || ip.startsWith("127.") || ip.startsWith("192.168")) return "Unknown"; if (ip == null || ip.isEmpty() || ip.startsWith("10.") || ip.startsWith("127.") || ip.startsWith("192.168")) return "Unknown";
if (ip.startsWith("100.")) return "Local Provider Network";
return databaseReader.city(InetAddress.getByName(ip)).getCity().getName(); return databaseReader.city(InetAddress.getByName(ip)).getCity().getName();
} catch (Exception e) { } catch (Exception e) {
logger.error("[IGNORING] Cannot fetch city of ip: " + ip, e); logger.error("[IGNORING] Cannot fetch city of ip: " + ip, e);

1
src/main/java/app/services/io/readers/GeoIPCountry.java

@ -27,6 +27,7 @@ public class GeoIPCountry extends BaseReader {
public String GetCountry(String ip) { public String GetCountry(String ip) {
try { try {
if (ip == null || ip.isEmpty() || ip.startsWith("10.") || ip.startsWith("127.") || ip.startsWith("192.168")) return "Unknown"; if (ip == null || ip.isEmpty() || ip.startsWith("10.") || ip.startsWith("127.") || ip.startsWith("192.168")) return "Unknown";
if (ip.startsWith("100.")) return "Local Provider Network";
return databaseReader.country(InetAddress.getByName(ip)).getCountry().getName(); return databaseReader.country(InetAddress.getByName(ip)).getCountry().getName();
} catch (Exception e) { } catch (Exception e) {
logger.error("[IGNORING] Cannot fetch country of ip: " + ip); logger.error("[IGNORING] Cannot fetch country of ip: " + ip);

Loading…
Cancel
Save