java.lang.Object
net.i2p.i2ptunnel.socks.SOCKSUDPWrapper
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Map<I2PSocketAddress, SOCKSHeader> Headers remembered for each peer addressprivate SinkWhere the wrapped datagram is sent.Constructor Summary
ConstructorsConstructorDescriptionSOCKSUDPWrapper(Map<I2PSocketAddress, SOCKSHeader> cache) Create a wrapper sharing an existing per-destination header cache.Method Summary
All MethodsModifier and TypeMethodDescriptionvoidsend(Destination from, int fromPort, int toPort, byte[] data) Use the cached header, which should have the host string and portvoidSets the sink for outgoing wrapped UDP datagrams.voidstart()Starts the wrapper.
Field Details
sink
Where the wrapped datagram is sent.cache
Headers remembered for each peer address
Constructor Details
SOCKSUDPWrapper
Create a wrapper sharing an existing per-destination header cache.- Parameters:
cache- the header cache to reuse for outgoing datagrams, keyed by destination address
Method Details
setSink
start
send
Use the cached header, which should have the host string and portMay throw RuntimeException from underlying sink.
- Specified by:
sendin interfaceSink- Parameters:
from- some implementations may ignore, may be null in some implementationsfromPort- I2CP source port, 0-65535toPort- I2CP destination port, 0-65535data- the datagram payload to deliver to the destination- Throws:
RuntimeException- if the wrapped sink fails to send the data