java.lang.Object
net.i2p.i2ptunnel.udp.I2PSinkAnywhere
- All Implemented Interfaces:
Sink
I2P sink implementation that sends datagrams to any destination specified in each
send(Destination, byte[]) call, rather than a fixed destination.Supports both repliable and raw datagram modes. When not in raw mode, data is wrapped with I2PDatagramMaker before sending.
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final I2PDatagramMakerWraps outgoing datagrams, or null in raw mode.protected final booleanTrue when datagrams are sent without I2P datagram wrapping.protected final I2PSessionThe session datagrams are sent over.Constructor Summary
ConstructorsConstructorDescriptionI2PSinkAnywhere(I2PSession sess) Creates a repliable (non-raw) sink for the given session.I2PSinkAnywhere(I2PSession sess, boolean raw) Creates a sink for the given session.Method Summary
All MethodsModifier and TypeMethodDescriptionvoidsend(Destination to, byte[] data) Sends data to the specified destination using default ports.voidsend(Destination to, int fromPort, int toPort, byte[] data) Sends data to the specified destination using the given ports.
Field Details
raw
protected final boolean rawTrue when datagrams are sent without I2P datagram wrapping.sess
The session datagrams are sent over.maker
Wraps outgoing datagrams, or null in raw mode.
Constructor Details
I2PSinkAnywhere
Creates a repliable (non-raw) sink for the given session.- Parameters:
sess- the I2P session to send through
I2PSinkAnywhere
Creates a sink for the given session.- Parameters:
sess- the I2P session to send throughraw- true for raw datagrams, false for repliable
Method Details
send
Sends data to the specified destination using default ports.- Parameters:
to- the destination to send todata- the data to send- Throws:
RuntimeException- if the session is closed
send
Sends data to the specified destination using the given ports.- Specified by:
sendin interfaceSink- Parameters:
to- the destination to send tofromPort- I2CP source port, 0-65535toPort- I2CP destination port, 0-65535data- the data to send- Throws:
RuntimeException- if the session is closed