Transport: Revert GeoIP changes that broke BundleRouterInfos

This commit is contained in:
zzz
2019-05-10 11:46:25 +00:00
parent c7d052646e
commit d8980d10a4

View File

@ -125,8 +125,10 @@ public class GeoIP {
/** /**
* Blocking lookup of all pending IPs. * Blocking lookup of all pending IPs.
* Results will be added to the table and available via get() after completion. * Results will be added to the table and available via get() after completion.
*
* Public for BundleRouterInfos
*/ */
void blockingLookup() { public void blockingLookup() {
if (! _context.getBooleanPropertyDefaultTrue(PROP_GEOIP_ENABLED)) { if (! _context.getBooleanPropertyDefaultTrue(PROP_GEOIP_ENABLED)) {
_pendingSearch.clear(); _pendingSearch.clear();
_pendingIPv6Search.clear(); _pendingIPv6Search.clear();
@ -496,9 +498,11 @@ public class GeoIP {
/** /**
* Add to the list needing lookup * Add to the list needing lookup
* Public for BundleRouterInfos
*
* @param ip IPv4 or IPv6 * @param ip IPv4 or IPv6
*/ */
void add(String ip) { public void add(String ip) {
byte[] pib = Addresses.getIP(ip); byte[] pib = Addresses.getIP(ip);
if (pib == null) return; if (pib == null) return;
add(pib); add(pib);
@ -506,9 +510,11 @@ public class GeoIP {
/** /**
* Add to the list needing lookup * Add to the list needing lookup
* Public for BundleRouterInfos
*
* @param ip IPv4 or IPv6 * @param ip IPv4 or IPv6
*/ */
void add(byte ip[]) { public void add(byte ip[]) {
add(toLong(ip)); add(toLong(ip));
} }
@ -525,10 +531,12 @@ public class GeoIP {
/** /**
* Get the country for an IP from the cache. * Get the country for an IP from the cache.
* Public for BundleRouterInfos
*
* @param ip IPv4 or IPv6 * @param ip IPv4 or IPv6
* @return lower-case code, generally two letters, or null. * @return lower-case code, generally two letters, or null.
*/ */
String get(String ip) { public String get(String ip) {
byte[] pib = Addresses.getIP(ip); byte[] pib = Addresses.getIP(ip);
if (pib == null) return null; if (pib == null) return null;
return get(pib); return get(pib);
@ -593,10 +601,12 @@ public class GeoIP {
/** /**
* Get the country for a country code * Get the country for a country code
* Public for BundleRouterInfos
*
* @param code two-letter lower case code * @param code two-letter lower case code
* @return untranslated name or null * @return untranslated name or null
*/ */
String fullName(String code) { public String fullName(String code) {
return _codeToName.get(code); return _codeToName.get(code);
} }