net.i2p.router.transport.udp

## Class UDPAddress

- java.lang.Object
- - net.i2p.router.transport.udp.UDPAddress

-     class UDPAddress
      extends Object

  UDP address parser and validator for I2P peer information. This class parses and validates UDP address strings containing peer introduction information. It extracts hostnames, ports, introduction keys, and other metadata needed for establishing SSU connections. Parsing Features:
  - Hostname and IP address extraction
  - Port number parsing and validation
  - Introduction key and tag parsing
  - Multiple introduction point support
  - Expiration time and bandwidth information
  Validation:
  - Address format validation
  - Port range checking
  - Introduction key format validation
  - Hostname resolution and verification
  Output Format:
  - Structured peer information objects
  - Validated address components
  - Parsed introduction metadata

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static char` | `CAPACITY_INTRODUCER`
    `static char` | `CAPACITY_TESTING`
    `(package private) static int` | `MAX_INTRODUCERS`
    `static String` | `PROP_CAPACITY`
    `static String` | `PROP_HOST`
    `static String` | `PROP_INTRO_EXP_PREFIX`
    `static String` | `PROP_INTRO_HASH_PREFIX`
    `static String` | `PROP_INTRO_HOST_PREFIX`
    `static String` | `PROP_INTRO_KEY`
    `static String` | `PROP_INTRO_KEY_PREFIX`
    `static String` | `PROP_INTRO_PORT_PREFIX`
    `(package private) static String[]` | `PROP_INTRO_TAG`
    `static String` | `PROP_INTRO_TAG_PREFIX`
    `static String` | `PROP_MTU`
    `static String` | `PROP_PORT`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `UDPAddress(RouterAddress addr)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `(package private) static void` | `clearCache()`
    `String` | `getHost()`
    `(package private) InetAddress` | `getHostAddress()` As of 0.9.32, will NOT resolve hostnames.
    `(package private) int` | `getIntroducerCount()`
    `(package private) long` | `getIntroducerExpiration(int i)`
    `(package private) Hash` | `getIntroducerHash(int i)`
    `(package private) InetAddress` | `getIntroducerHost(int i)` As of 0.9.32, will NOT resolve hostnames.
    `(package private) byte[]` | `getIntroducerKey(int i)`
    `(package private) int` | `getIntroducerPort(int i)`
    `(package private) long` | `getIntroducerTag(int i)`
    `(package private) byte[]` | `getIntroKey()`
    `(package private) int` | `getMTU()`
    `int` | `getPort()`
    `(package private) boolean` | `isIPv4()`
    `(package private) boolean` | `isIPv6()`
    `String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### CAPACITY_INTRODUCER

          public static final char CAPACITY_INTRODUCER

      See Also:
        Constant Field Values

    - #### CAPACITY_TESTING

          public static final char CAPACITY_TESTING

      See Also:
        Constant Field Values

    - #### MAX_INTRODUCERS

          static final int MAX_INTRODUCERS

      See Also:
        Constant Field Values

    - #### PROP_CAPACITY

          public static final String PROP_CAPACITY

      See Also:
        Constant Field Values

    - #### PROP_HOST

          public static final String PROP_HOST

      See Also:
        Constant Field Values

    - #### PROP_INTRO_EXP_PREFIX

          public static final String PROP_INTRO_EXP_PREFIX

      See Also:
        Constant Field Values

    - #### PROP_INTRO_HASH_PREFIX

          public static final String PROP_INTRO_HASH_PREFIX

      See Also:
        Constant Field Values

    - #### PROP_INTRO_HOST_PREFIX

          public static final String PROP_INTRO_HOST_PREFIX

      See Also:
        Constant Field Values

    - #### PROP_INTRO_KEY

          public static final String PROP_INTRO_KEY

      See Also:
        Constant Field Values

    - #### PROP_INTRO_KEY_PREFIX

          public static final String PROP_INTRO_KEY_PREFIX

      See Also:
        Constant Field Values

    - #### PROP_INTRO_PORT_PREFIX

          public static final String PROP_INTRO_PORT_PREFIX

      See Also:
        Constant Field Values

    - #### PROP_INTRO_TAG

          static final String[] PROP_INTRO_TAG

    - #### PROP_INTRO_TAG_PREFIX

          public static final String PROP_INTRO_TAG_PREFIX

      See Also:
        Constant Field Values

    - #### PROP_MTU

          public static final String PROP_MTU

      See Also:
        Constant Field Values

    - #### PROP_PORT

          public static final String PROP_PORT

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### UDPAddress

          public UDPAddress(RouterAddress addr)

  - ### Method Detail

    - #### clearCache

          static void clearCache()

    - #### getHost

          public String getHost()

    - #### getHostAddress

          InetAddress getHostAddress()

      As of 0.9.32, will NOT resolve hostnames.
      Returns:
        InetAddress or null

    - #### getIntroducerCount

          int getIntroducerCount()

    - #### getIntroducerExpiration

          long getIntroducerExpiration(int i)

      Returns:
        ms since epoch, zero if unset
      Throws:
        `NullPointerException` - if getIntroducerCount() == 0
        `ArrayIndexOutOfBoundsException` - if i < 0 or i >= getIntroducerCount()

    - #### getIntroducerHash

          Hash getIntroducerHash(int i)

      Returns:
        null if no keys or for SSU1
      Throws:
        `ArrayIndexOutOfBoundsException` - if i < 0 or i >= getIntroducerCount()

    - #### getIntroducerHost

          InetAddress getIntroducerHost(int i)

      As of 0.9.32, will NOT resolve hostnames.
      Returns:
        null if invalid or for SSU2
      Throws:
        `ArrayIndexOutOfBoundsException` - if i < 0 or i >= getIntroducerCount()

    - #### getIntroducerKey

          byte[] getIntroducerKey(int i)

      Returns:
        null if no keys or for SSU2
      Throws:
        `ArrayIndexOutOfBoundsException` - if i < 0 or i >= getIntroducerCount()

    - #### getIntroducerPort

          int getIntroducerPort(int i)

      Returns:
        greater than zero or zero for SSU2
      Throws:
        `ArrayIndexOutOfBoundsException` - if i < 0 or i >= getIntroducerCount()

    - #### getIntroducerTag

          long getIntroducerTag(int i)

      Returns:
        greater than zero
      Throws:
        `NullPointerException` - if getIntroducerCount() == 0
        `ArrayIndexOutOfBoundsException` - if i < 0 or i >= getIntroducerCount()

    - #### getIntroKey

          byte[] getIntroKey()

      Returns:
        shouldn't be null but will be if invalid

    - #### getMTU

          int getMTU()

      Returns:
        0 if unset or invalid; recitified via MTU.rectify()

    - #### getPort

          public int getPort()

      Returns:
        0 if unset or invalid

    - #### isIPv4

          boolean isIPv4()

    - #### isIPv6

          boolean isIPv6()

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`