diff --git a/installer/resources/continents.txt b/installer/resources/continents.txt index 4a7750b700065d9dac2bf6c48fde7a80e667db92..5a0abe38023cffb22b30cb28d91d097e7eca0380 100644 --- a/installer/resources/continents.txt +++ b/installer/resources/continents.txt @@ -248,6 +248,7 @@ VN,AS VU,OC WF,OC WS,OC +XK,EU YE,AS YT,AF ZA,AF diff --git a/installer/resources/countries.txt b/installer/resources/countries.txt index 9702197ef587bf5d6239c8b1a48c9ff8bbc570bc..f3dff7efe434d078ccdcfe9c79ae66c6066a1a89 100644 --- a/installer/resources/countries.txt +++ b/installer/resources/countries.txt @@ -254,6 +254,7 @@ VN,Vietnam VU,Vanuatu WF,Wallis and Futuna WS,Samoa +XK,Kosovo YE,Yemen YT,Mayotte ZA,South Africa diff --git a/router/java/src/net/i2p/router/transport/GeoIP.java b/router/java/src/net/i2p/router/transport/GeoIP.java index ce77b9c4ca2107317e2937320f46222009b0c3f3..a22fa3758844c751a13c4a399436ad113300f314 100644 --- a/router/java/src/net/i2p/router/transport/GeoIP.java +++ b/router/java/src/net/i2p/router/transport/GeoIP.java @@ -84,6 +84,8 @@ public class GeoIP { private static final boolean ENABLE_DEBIAN = !DISABLE_DEBIAN && !(SystemVersion.isWindows() || SystemVersion.isAndroid()); /** maxmind API */ private static final String UNKNOWN_COUNTRY_CODE = "--"; + /** db-ip.com https://db-ip.com/faq.php */ + private static final String UNKNOWN_COUNTRY_CODE2 = "ZZ"; /** * @param context RouterContext in production, I2PAppContext for testing only @@ -223,7 +225,7 @@ public class GeoIP { String ipv4 = toV4(ipl); // returns upper case or null String uc = dbr.country(ipv4); - if (uc != null) { + if (uc != null && !uc.equals(UNKNOWN_COUNTRY_CODE2)) { String lc = uc.toLowerCase(Locale.US); String cached = _codeCache.get(lc); if (cached == null) @@ -294,7 +296,7 @@ public class GeoIP { String ipv6 = toV6(ipl); // returns upper case or null String uc = dbr.country(ipv6); - if (uc != null) { + if (uc != null && !uc.equals(UNKNOWN_COUNTRY_CODE2)) { String lc = uc.toLowerCase(Locale.US); String cached = _codeCache.get(lc); if (cached == null)