I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Unverified Commit ce53714b authored by zzz's avatar zzz
Browse files

Util: Add AddressType enum

parent 50ce3c28
No related branches found
No related tags found
No related merge requests found
package net.i2p.util;
/**
* @since 0.9.54
*/
public enum AddressType {
IPV4, IPV6, YGG
}
......@@ -54,6 +54,26 @@ public abstract class Addresses {
private static final Set<String> _macCache = new HashSet<String>();
private static final boolean TEST_IPV6_ONLY = false;
/**
* Do we have any address of this type?
* Warning, very slow on Windows, appx. 200ms + 50ms/interface
*
* @since 0.9.54
*/
public static boolean isConnected(AddressType type) {
switch(type) {
case IPV6:
return isConnectedIPv6();
case YGG:
return getYggdrasilAddress() != null;
case IPV4:
default:
return isConnected();
}
}
/**
* Do we have any non-loop, non-wildcard IPv4 address at all?
* Warning, very slow on Windows, appx. 200ms + 50ms/interface
......@@ -266,7 +286,7 @@ public abstract class Addresses {
/**
* Warning, very slow on Windows. Caller should cache.
*
* @return the IPv6 address with prefix 02xx: or 03xx:
* @return the IPv6 address with prefix 02xx: or 03xx:, or null
* @since 0.9.49
*/
public static byte[] getYggdrasilAddress() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment