public class GeoIP extends Object
Modifier and Type | Field and Description |
---|---|
(package private) static String |
COUNTRY_FILE_DEFAULT |
static String |
GEOIP_DIR_DEFAULT |
(package private) static String |
GEOIP_FILE_DEFAULT |
static String |
GEOIP2_FILE_DEFAULT |
static String |
PROP_BLOCK_MY_COUNTRY |
static String |
PROP_DEBIAN_GEOIP |
static String |
PROP_DEBIAN_GEOIPV6 |
static String |
PROP_GEOIP_DIR |
(package private) static String |
PROP_GEOIP_ENABLED |
static String |
PROP_IP_COUNTRY |
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
|
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.
|
Map<String,String> |
getCountries()
Get the country code map
|
static void |
main(String[] args) |
(package private) static void |
notifyVersion(I2PAppContext ctx,
String subtype,
long version)
Tell the update manager.
|
void |
shutdown() |
static final String PROP_GEOIP_ENABLED
public static final String PROP_GEOIP_DIR
public static final String GEOIP_DIR_DEFAULT
static final String GEOIP_FILE_DEFAULT
public static final String GEOIP2_FILE_DEFAULT
static final String COUNTRY_FILE_DEFAULT
public static final String PROP_IP_COUNTRY
public static final String PROP_DEBIAN_GEOIP
public static final String PROP_DEBIAN_GEOIPV6
public static final String PROP_BLOCK_MY_COUNTRY
public GeoIP(I2PAppContext context)
context
- RouterContext in production, I2PAppContext for testing onlypublic void shutdown()
public void blockingLookup()
static void notifyVersion(I2PAppContext ctx, String subtype, long version)
public void add(String ip)
ip
- IPv4 or IPv6public void add(byte[] ip)
ip
- IPv4 or IPv6public String get(String ip)
ip
- IPv4 or IPv6String get(byte[] ip)
ip
- IPv4 or IPv6public String fullName(String code)
code
- two-letter lower case codepublic Map<String,String> getCountries()
public static void main(String[] args)