public abstract class TransportUtil extends Object
| Modifier and Type | Class and Description |
|---|---|
static class | TransportUtil.IPv6ConfigIPv6 configuration options for transports. |
| Modifier and Type | Field and Description |
|---|---|
static TransportUtil.IPv6Config | DEFAULT_IPV6_CONFIGDEFAULT_IPV6_CONFIG. |
static String | NTCP_IPV6_CONFIGNTCP_IPV6_CONFIG. |
static String | PROP_IPV4_FIREWALLEDPROP_IPV4_FIREWALLED. |
static String | PROP_IPV6_FIREWALLED |
static String | SSU_IPV6_CONFIGSSU_IPV6_CONFIG. |
| Constructor and Description |
|---|
TransportUtil() |
| Modifier and Type | Method and Description |
|---|---|
static TransportUtil.IPv6Config | getIPv6Config(RouterContext ctx,
String transportStyle)The IPv6 config for the given transport style. |
static TransportUtil.IPv6Config | getIPv6Config(String cfg)The IPv6 config for the given config string. |
static AddressType | getType(byte[] ip)Address type of the given IP address. |
static AddressType | getType(RouterAddress addr)Address type of the given RouterAddress. |
static AddressType | getType(String host)Address type of the given host string. |
static boolean | isIPv4Firewalled(RouterContext ctx)This returns true if the force-firewalled setting is configured, false otherwise. |
static boolean | isIPv6(RouterAddress addr)Addresses without a host (i.e. |
static boolean | isIPv6Firewalled(RouterContext ctx)This returns true if the force-firewalled setting is configured, false otherwise. |
static boolean | isPubliclyRoutable(byte[] addr,
boolean allowIPv6)Whether the address is publicly routable, optionally allowing IPv6. |
static boolean | isPubliclyRoutable(byte[] addr,
boolean allowIPv4,
boolean allowIPv6)Ref: RFC 5735 |
static boolean | isValidPort(int port)Is this a valid port for us or a remote router?
ref: http://i2p-projekt.i2p/en/docs/ports
ref: https://cs.chromium.org/chromium/src/net/base/port_util.cc |
static boolean | isYggdrasil(RouterAddress addr)Whether the address is an in-network Yggdrasil address. |
static void | logInvalidPort(Log log,
String transportStyle,
int port)Logs an error for an invalid port. |
static int | selectRandomPort(RouterContext ctx,
String transportStyle)Pick a random port between the configured boundaries |
public static final TransportUtil.IPv6Config DEFAULT_IPV6_CONFIG
public static final String NTCP_IPV6_CONFIG
public static final String PROP_IPV4_FIREWALLED
public static final String PROP_IPV6_FIREWALLED
public static final String SSU_IPV6_CONFIG
public static TransportUtil.IPv6Config getIPv6Config(RouterContext ctx, String transportStyle)
public static TransportUtil.IPv6Config getIPv6Config(String cfg)
public static AddressType getType(byte[] ip)
public static AddressType getType(RouterAddress addr)
public static AddressType getType(String host)
public static boolean isIPv4Firewalled(RouterContext ctx)
public static boolean isIPv6(RouterAddress addr)
addr - non-nullpublic static boolean isIPv6Firewalled(RouterContext ctx)
public static boolean isPubliclyRoutable(byte[] addr,
boolean allowIPv6)addr - non-nullpublic static boolean isPubliclyRoutable(byte[] addr,
boolean allowIPv4,
boolean allowIPv6)addr - non-nullpublic static boolean isValidPort(int port)
public static boolean isYggdrasil(RouterAddress addr)
public static void logInvalidPort(Log log, String transportStyle, int port)
public static int selectRandomPort(RouterContext ctx, String transportStyle)