net.i2p.i2ptunnel.socks

## Class SOCKSUDPWrapper

- java.lang.Object
- - net.i2p.i2ptunnel.socks.SOCKSUDPWrapper

- All Implemented Interfaces:
    Sink, Source

      public class SOCKSUDPWrapper
      extends Object
      implements Source, Sink

  Put a SOCKS header on a datagram Ref: RFC 1928

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SOCKSUDPWrapper(Map<I2PSocketAddress,SOCKSHeader> cache)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `send(Destination from, int fromPort, int toPort, byte[] data)` Use the cached header, which should have the host string and port May throw RuntimeException from underlying sink
    `void` | `setSink(Sink sink)` Sets the sink for outgoing wrapped UDP datagrams.
    `void` | `start()` Starts the wrapper.

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

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

- - ### Constructor Detail

    - #### SOCKSUDPWrapper

          public SOCKSUDPWrapper(Map<I2PSocketAddress,SOCKSHeader> cache)

  - ### Method Detail

    - #### send

          public void send(Destination from,
                           int fromPort,
                           int toPort,
                           byte[] data)

      Use the cached header, which should have the host string and port May throw RuntimeException from underlying sink
      Specified by:
        `send` in interface `Sink`
      Parameters:
        `from` - some implementations may ignore, may be null in some implementations
        `fromPort` - I2CP source port, 0-65535
        `toPort` - I2CP destination port, 0-65535
      Throws:
        `RuntimeException`

    - #### setSink

          public void setSink(Sink sink)

      Sets the sink for outgoing wrapped UDP datagrams.
      Specified by:
        `setSink` in interface `Source`
      Parameters:
        `sink` - the sink to receive SOCKS-wrapped datagrams

    - #### start

          public void start()

      Starts the wrapper. No-op for this implementation.
      Specified by:
        `start` in interface `Source`