Class TransportUtil

java.lang.Object
net.i2p.router.transport.TransportUtil

public abstract class TransportUtil extends Object
Since:
IPv6
  • Field Details

  • Constructor Details

    • TransportUtil

      public TransportUtil()
  • Method Details

    • getIPv6Config

      public static TransportUtil.IPv6Config getIPv6Config(RouterContext ctx, String transportStyle)
    • getIPv6Config

      public static TransportUtil.IPv6Config getIPv6Config(String cfg)
    • isIPv4Firewalled

      public static boolean isIPv4Firewalled(RouterContext ctx, String transportStyle)
      This returns true if the force-firewalled setting is configured, false otherwise.
      Parameters:
      transportStyle - ignored
      Since:
      0.9.20
    • isIPv6Firewalled

      public static boolean isIPv6Firewalled(RouterContext ctx, String transportStyle)
      This returns true if the force-firewalled setting is configured, false otherwise.
      Parameters:
      transportStyle - ignored
      Since:
      0.9.27, implemented in 0.9.28
    • isIPv6

      public static boolean isIPv6(RouterAddress addr)
      Addresses without a host (i.e. w/introducers) are assumed to be IPv4 unless a '6' cap is present
      Parameters:
      addr - non-null
    • isYggdrasil

      public static boolean isYggdrasil(RouterAddress addr)
      Since:
      0.9.49
    • getType

      public static AddressType getType(RouterAddress addr)
      Returns:
      null if unknown
      Since:
      0.9.54
    • getType

      public static AddressType getType(String host)
      Returns:
      null if unknown
      Since:
      0.9.54
    • getType

      public static AddressType getType(byte[] ip)
      Returns:
      null if unknown
      Since:
      0.9.54
    • isPubliclyRoutable

      public static boolean isPubliclyRoutable(byte[] addr, boolean allowIPv6)
      Parameters:
      addr - non-null
      Since:
      IPv6 moved from TransportImpl
    • isPubliclyRoutable

      public static boolean isPubliclyRoutable(byte[] addr, boolean allowIPv4, boolean allowIPv6)
      Ref: RFC 5735
      Parameters:
      addr - non-null
      Since:
      IPv6
    • isValidPort

      public 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
      Since:
      0.9.17 moved from logic in individual transports
    • logInvalidPort

      public static void logInvalidPort(Log log, String transportStyle, int port)
      log an error
      Since:
      0.9.39 pulled out of UDPEndpoint
    • selectRandomPort

      public static int selectRandomPort(RouterContext ctx, String transportStyle)
      Pick a random port between the configured boundaries
      Since:
      IPv6, moved from UDPEndpoint in 0.9.39 to support NTCP also