net.i2p.i2ptunnel.socks

## Class SOCKSUDPTunnel

- java.lang.Object
- - net.i2p.util.EventDispatcherImpl
  - - net.i2p.i2ptunnel.I2PTunnelTask
    - - net.i2p.i2ptunnel.udpTunnel.I2PTunnelUDPClientBase
      - - net.i2p.i2ptunnel.socks.SOCKSUDPTunnel

- All Implemented Interfaces:
    Sink, Source, EventDispatcher

      public class SOCKSUDPTunnel
      extends I2PTunnelUDPClientBase

  A Datagram Tunnel that can have multiple bidirectional ports on the UDP side. TX: (multiple SOCKSUDPPorts -> ) I2PSink RX: (SOCKSUDPWrapper in multiple SOCKSUDPPorts <- ) MultiSink <- I2PSource The replies must be to the same I2CP toPort as the outbound fromPort. If the server does not honor that, the replies will be dropped. The replies must be repliable. Raw datagrams are not supported, and would require a unique source port for each target. Preliminary, untested, possibly incomplete.

- - ### Field Summary

    - ### Fields inherited from class net.i2p.i2ptunnel.udpTunnel.I2PTunnelUDPClientBase

      `_clientId, _context, l`

    - ### Fields inherited from class net.i2p.i2ptunnel.I2PTunnelTask

      `open, tunnel`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SOCKSUDPTunnel(I2PTunnel tunnel)` Set up a tunnel with no UDP side yet.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `add(InetAddress host, int port)` Adds a new UDP port to the tunnel for bidirectional SOCKS UDP communication.
    `boolean` | `close(boolean forced)` Closes the tunnel and all associated ports.
    `void` | `remove(Integer port)` Removes a UDP port from the tunnel and stops its associated resources.
    `void` | `startRunning()` Starts the tunnel and begins processing datagrams.

    - ### Methods inherited from class net.i2p.i2ptunnel.udpTunnel.I2PTunnelUDPClientBase

      `send, setSink, start`

    - ### Methods inherited from class net.i2p.i2ptunnel.I2PTunnelTask

      `connected, destroy, disconnected, errorOccurred, getBooleanOption, getId, getTunnel, isOpen, optionsUpdated, reportAbuse, routerDisconnected, setId, setName, setTunnel, toString`

    - ### Methods inherited from class net.i2p.util.EventDispatcherImpl

      `attachEventDispatcher, detachEventDispatcher, getEventDispatcher, getEvents, getEventValue, ignoreEvents, notifyEvent, unIgnoreEvents, waitEventValue`

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

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

- - ### Constructor Detail

    - #### SOCKSUDPTunnel

          public SOCKSUDPTunnel(I2PTunnel tunnel)

      Set up a tunnel with no UDP side yet. Use add() for each port.

  - ### Method Detail

    - #### add

          public int add(InetAddress host,
                         int port)

      Adds a new UDP port to the tunnel for bidirectional SOCKS UDP communication.
      Parameters:
        `host` - the local address to bind to
        `port` - the local port to bind to, or 0 for any available port
      Returns:
        the actual port number the socket was bound to

    - #### close

          public boolean close(boolean forced)

      Closes the tunnel and all associated ports.
      Overrides:
        `close` in class `I2PTunnelUDPClientBase`
      Parameters:
        `forced` - if true, force immediate close without graceful shutdown
      Returns:
        true if closed successfully

    - #### remove

          public void remove(Integer port)

      Removes a UDP port from the tunnel and stops its associated resources.
      Parameters:
        `port` - the UDP port number to remove

    - #### startRunning

          public final void startRunning()

      Starts the tunnel and begins processing datagrams. Ports must be added after this call.
      Overrides:
        `startRunning` in class `I2PTunnelUDPClientBase`