public class GeoIP extends Object
| Modifier and Type | Field and Description |
|---|---|
static String | ASN_FILE_DEFAULTASN_FILE_DEFAULT. |
(package private) static String | COUNTRY_FILE_DEFAULTDefault country names file name |
static String | GEOIP_DIR_DEFAULTGEOIP_DIR_DEFAULT. |
(package private) static String | GEOIP_FILE_DEFAULTDefault geoip file name |
static String | GEOIP2_FILE_DEFAULTGEOIP2_FILE_DEFAULT. |
static String | PROP_BLOCK_MY_COUNTRYPROP_BLOCK_MY_COUNTRY. |
static String | PROP_DEBIAN_GEOIPPROP_DEBIAN_GEOIP. |
static String | PROP_DEBIAN_GEOIPV6PROP_DEBIAN_GEOIPV6. |
static String | PROP_GEOIP_DIRPROP_GEOIP_DIR. |
(package private) static String | PROP_GEOIP_ENABLEDP r o p g e o i p e n a b l e d |
static String | PROP_IP_COUNTRYPROP_IP_COUNTRY. |
(package private) static String | PROP_NORMALIZE_ISPNormalize ISP/org names from ASN database (strip suffixes, abbreviate, title-case) |
| Constructor and Description |
|---|
GeoIP(I2PAppContext context) |
| Modifier and Type | Method and Description |
|---|---|
void | add(byte[] ip)Add to the list needing lookup
Public for BundleRouterInfos |
void | add(String ip)Add to the list needing lookup
Public for BundleRouterInfos |
static void | banCountry(RouterContext ctx,
String country)Bans routers located in a specified country. |
void | blockingLookup()Blocking lookup of all pending IPs. |
String | fullName(String code)Get the country for a country code
Public for BundleRouterInfos |
(package private) String | get(byte[] ip)Get the country for an IP from the cache. |
String | get(String ip)Get the country for an IP from the cache. |
String | getASNBuildInfo()Return the current ASN database version |
Map<String,String> | getCountries()Get the country code map |
String | getGeoIPBuildInfo() |
String | getOrgName(String ipAddress)Get the organization name for an IP from the local ASN database. |
static String | normalizeOrgName(String raw)Normalize an ISP/org name from the ASN database. |
(package private) static void | notifyVersion(I2PAppContext ctx,
String subtype,
long version)Tell the update manager. |
void | shutdown()Shutdown and release resources. |
public static final String ASN_FILE_DEFAULT
static final String COUNTRY_FILE_DEFAULT
public static final String GEOIP_DIR_DEFAULT
static final String GEOIP_FILE_DEFAULT
public static final String GEOIP2_FILE_DEFAULT
public static final String PROP_BLOCK_MY_COUNTRY
public static final String PROP_DEBIAN_GEOIP
public static final String PROP_DEBIAN_GEOIPV6
public static final String PROP_GEOIP_DIR
static final String PROP_GEOIP_ENABLED
public static final String PROP_IP_COUNTRY
static final String PROP_NORMALIZE_ISP
public GeoIP(I2PAppContext context)
context - RouterContext in production, I2PAppContext for testing onlypublic void add(byte[] ip)
ip - IPv4 or IPv6public void add(String ip)
ip - IPv4 or IPv6public static void banCountry(RouterContext ctx, String country)
ctx - the RouterContext instance providing access to network database and banlistcountry - the country code (ISO 3166-1 alpha-2 format) of the country whose routers should be bannedpublic void blockingLookup()
public String fullName(String code)
code - two-letter lower case codeString get(byte[] ip)
ip - IPv4 or IPv6public String get(String ip)
ip - IPv4 or IPv6public String getASNBuildInfo()
public Map<String,String> getCountries()
public String getGeoIPBuildInfo()
public String getOrgName(String ipAddress)
ipAddress - IPv4 or IPv6 address stringpublic static String normalizeOrgName(String raw)
raw - original org name from MMDBstatic void notifyVersion(I2PAppContext ctx, String subtype, long version)
public void shutdown()