public abstract class AbstractAnonUDPChannel extends java.lang.Object implements IAnonUDPChannel
Modifier and Type | Class and Description |
---|---|
private class |
AbstractAnonUDPChannel.AnonUDPChannelInputStream |
private class |
AbstractAnonUDPChannel.AnonUDPChannelOutputStream
Output stream which can be sued to send data to the recipient.
|
Modifier and Type | Field and Description |
---|---|
private AbstractAnonUDPChannel.AnonUDPChannelInputStream |
m_anonUDPInputStream |
private AbstractAnonUDPChannel.AnonUDPChannelOutputStream |
m_anonUDPOutputStream |
protected int |
m_iDstPort |
protected int |
m_iSrcPort |
protected java.lang.String |
m_strDstHost |
HTTP, SMTP, SOCKS, TCP, UDP, UDP_OVER_TCP, UDP_OVER_UDP, VPN
Modifier | Constructor and Description |
---|---|
protected |
AbstractAnonUDPChannel() |
Modifier and Type | Method and Description |
---|---|
java.io.InputStream |
getInputStream()
The returned InputStream could be used to receive data.
|
java.io.OutputStream |
getOutputStream()
The returned OutputStream could be used to send data.
|
void |
setDestination(java.lang.String host,
int port) |
void |
setSentAutoFlushDelay(int msAutoFlushDelay)
Sets the time to wait before actually sending some data over this channel
in case the packet belonging to the underlying anonymisation protocol is
not full yet.
|
void |
setSourcePort(int port) |
void |
writePacket(byte[] payload) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
readPacket, writePacket
close, getOutputBlockSize, isClosed
private AbstractAnonUDPChannel.AnonUDPChannelOutputStream m_anonUDPOutputStream
private AbstractAnonUDPChannel.AnonUDPChannelInputStream m_anonUDPInputStream
protected java.lang.String m_strDstHost
protected int m_iDstPort
protected int m_iSrcPort
public void setDestination(java.lang.String host, int port)
setDestination
in interface IAnonUDPChannel
host
- the domain name of the target hostport
- the target port numberpublic void setSourcePort(int port)
setSourcePort
in interface IAnonUDPChannel
port
- the target port numberpublic void setSentAutoFlushDelay(int msAutoFlushDelay)
This method can be used for performance optimisations / efficiency. One
use case would be if you know that this channel will sent data
immediately after connection establishment. Therefore you would call
setSentAutoFlushDelay
with some delayvalue > 0
just before you call the connect
method. If you call
Outputstream.write
within delayvalue
milliseconds after the connect
call then the data you intend
to sent will be piggybacked on the connect request. This will save some
roundtrip-time delay.
Additionally, using this method correctly could decrease the bandwidth overhead introduced by the underlying anonymisation protocol. Many anonymisation protocols fragment the data stream into fixed sized packets which are filled with dummy data if not enough real data is available. Therefore waiting a certain amount of time for additional real data can increase the channel utilisation.
Note: This method will not do anything at the moment as the implementation is not ready yet.
setSentAutoFlushDelay
in interface IAnonUDPChannel
msAutoFlushDelay
- the amount of time in milliseconds to wait for new data before
the current sent buffer is flushed. Setting this value to
0
will always auto flush immediately. Setting this
value to -1
will only flush the sent buffer, if the
sent buffer is full, i.e. getOutputBufgferSize many bytes are
contained in the buffer.public void writePacket(byte[] payload) throws java.io.IOException
writePacket
in interface IAnonUDPChannel
java.io.IOException
public java.io.InputStream getInputStream()
AnonChannel
getInputStream
in interface AnonChannel
public java.io.OutputStream getOutputStream()
AnonChannel
getOutputStream
in interface AnonChannel
Copyright © 2023. All rights reserved.