public final class AnonProxy extends java.lang.Object implements AnonServiceEventListener
AnonChannel
objects. Below you find an example which creates a proxy which uses the AN.ON
mix cascade for anonymous web surfing.
AnonProxy theProxy = new AnonProxy(serverSocket, null);
theProxy.setMixCascade( new MixCascade(null, null, hostNameOfMixCascade,
portNumberOfMixCascade) );
theProxy.start();
Modifier and Type | Class and Description |
---|---|
private class |
AnonProxy.DummyMixCascadeContainer
Returns
null or false on all methods. |
private class |
AnonProxy.EncapsulatedMixCascadeContainer
Wraps an
AbstractMixCascadeContainer . |
private class |
AnonProxy.OpenSocketRequester
This class receives
SocketGuard objects via the
pushSocket() method
and starts AnonProxyRequest s, respecting the max. number of
requests that class can process requests. |
class |
AnonProxy.RoundRobinRequestQueue
This is a queue
|
private class |
AnonProxy.RunnableProxy
This object continuously accepts connections on the given
ServerSocket and, assuming, that there is a request to be sent
out, pushes resulting connected sockets to an AnonProxy.OpenSocketRequester
for further processing. |
Modifier and Type | Field and Description |
---|---|
static int |
E_MIX_PROTOCOL_NOT_SUPPORTED |
static int |
E_SIGNATURE_CHECK_FIRSTMIX_FAILED |
static int |
E_SIGNATURE_CHECK_OTHERMIX_FAILED |
private AnonClient |
m_Anon |
private java.util.Vector |
m_anonServiceListener |
private boolean |
m_bConnecting |
private boolean |
m_bReconnecting |
private boolean |
m_bShuttingDown |
private boolean |
m_bWeChanged |
private ProxyCallbackHandler |
m_callbackHandler |
private AbstractMixCascadeContainer |
m_containerMixCascade
Stores the MixCascade we are connected to.
|
private MixminionServiceDescription |
m_currentMixminionParams
Stores the Mixminion params.
|
private java.util.Vector |
m_currentStartThreads |
private TorAnonServerDescription |
m_currentTorParams
Stores the Tor params.
|
private DecompressionProxyCallback |
m_decompressionProxyCallback |
private boolean |
m_forwardedConnection
Stores, whether we use a forwarded connection (already active, when
AnonProxy is created) or not.
|
private HTTPProxyCallback |
m_httpProxyCallback |
private int |
m_maxDummyTrafficInterval
Stores the maximum dummy traffic interval in milliseconds -> we need
dummy traffic with at least that rate.
|
private int |
m_maxRequests |
private AnonService |
m_Mixminion |
private int |
m_numChannels |
private java.util.Observer |
m_observer |
private IMutableProxyInterface |
m_proxyInterface |
private IProxyListener |
m_ProxyListener |
private int |
m_socketGuardTimeout |
private java.net.ServerSocket |
m_socketListener |
private java.net.ServerSocket |
m_socketListenerTwo |
private java.lang.Thread |
m_tInit |
private AnonService |
m_Tor |
static int |
MIN_REQUESTS |
private static int |
RECONNECT_INTERVAL |
private java.lang.Object |
SHUTDOWN_SYNC |
private java.lang.Object |
SYNC_CALLBACK_HANDLER |
private java.lang.Object |
SYNC_THREAD_RUN |
private TermsAndConditionConfirmation |
termsConfirmation |
private java.lang.Object |
THREAD_SYNC |
private java.lang.Thread |
threadRunOne |
private java.lang.Thread |
threadRunTwo |
static int |
UNLIMITED_REQUESTS |
Modifier | Constructor and Description |
---|---|
|
AnonProxy(DirectProxy a_directProxy,
IMutableProxyInterface a_proxyInterface,
TermsAndConditionConfirmation termsConfirmation) |
|
AnonProxy(DirectProxy a_directProxy,
IStreamConnection a_proxyConnection,
MixCascade a_currentService,
int a_maxDummyTrafficInterval,
TermsAndConditionConfirmation termsConfirmation)
Creates a new AnonProxy with an already active mix connection.
|
private |
AnonProxy(DirectProxy a_directProxy,
java.net.ServerSocket a_listener,
IMutableProxyInterface a_proxyInterface,
TermsAndConditionConfirmation termsConfirmation) |
|
AnonProxy(java.net.ServerSocket a_listener,
IMutableProxyInterface a_proxyInterface,
TermsAndConditionConfirmation termsConfirmation)
Creates a new AnonProxy.
|
|
AnonProxy(java.net.ServerSocket a_listener,
TermsAndConditionConfirmation termsConfirmation,
int a_socketTimeout)
Creates a new AnonProxy.
|
Modifier and Type | Method and Description |
---|---|
void |
addEventListener(AnonServiceEventListener l) |
void |
addHTTPConnectionListener(AbstractHTTPConnectionListener listener) |
void |
connecting(AnonServerDescription a_serverDescription,
boolean a_bIsReconnect) |
void |
connectionError(AnonServiceException a_e) |
void |
connectionEstablished(AnonServerDescription a_serverDescription) |
int |
countStartThreads() |
(package private) AnonChannel |
createChannel(int type)
Creates a channel to the destination given to this proxy object, using
the underlying
AnonService . |
void |
currentServiceChanged(AnonServerDescription a_serverDescription) |
void |
dataChainErrorSignaled(AnonServiceException a_e) |
protected void |
decNumChannels()
Decreases the internal channel count and notifies any
IProxyListener objects registered to this AnonProxy . |
private void |
disableProxyCallback(ProxyCallback callback) |
void |
disconnected() |
private void |
enableProxyCallback(ProxyCallback callback) |
private void |
finishInitThread(MixCascade currentCascade,
ExceptionVariable retVar,
java.lang.Thread tInit) |
private void |
fireConnecting(AnonServerDescription a_serverDescription,
boolean a_bIsReconnect) |
private void |
fireConnectionEstablished(AnonServerDescription a_serverDescription) |
private void |
fireCurrentServiceChanged(AnonServerDescription a_serverDescription) |
private void |
fireDisconnected() |
int |
getMaxConcurrentRequests() |
MixCascade |
getMixCascade()
Returns the current Mix cascade
|
MixminionServiceDescription |
getMixminionParams() |
TorAnonServerDescription |
getTorParams() |
protected void |
incNumChannels()
Increases the internal channel count and notifies any
IProxyListener objects registered to this AnonProxy . |
void |
integrityErrorSignaled(AnonServiceException a_e) |
private boolean |
interruptInit(java.lang.Thread a_tInit) |
boolean |
isConnected() |
boolean |
isConnecting() |
private void |
joinInitThread(java.lang.Thread tInit,
ExceptionVariable retVar) |
void |
packetMixed(long a_totalBytes) |
(package private) void |
reconnect() |
void |
removeEventListener(AnonServiceEventListener l) |
void |
removeHTTPConnectionListener(AbstractHTTPConnectionListener listener) |
void |
setDebug(boolean bDebug) |
void |
setDummyTraffic(int a_interval)
Changes the dummy traffic interval on the connection to the server.
|
void |
setHTTPDecompressionEnabled(boolean enable) |
void |
setHTTPHeaderProcessingEnabled(boolean enable,
boolean b_force_proxy_callback) |
void |
setInterfaceBlockTimeout(long a_msTimeout)
Changes the timeout used for blocking an faulty interface of a Cascade.
|
void |
setMaxConcurrentRequests(int a_maxRequests) |
void |
setMixminionParams(MixminionServiceDescription newMixminionParams)
Sets the parameter for Mixminion (anonymous remailer).
|
void |
setProxyListener(IProxyListener l) |
void |
setTorParams(TorAnonServerDescription newTorParams)
Sets the parameter for TOR (anonymous SOCKS).
|
private void |
start_internal(AbstractMixCascadeContainer a_newMixCascade) |
void |
start(AbstractMixCascadeContainer a_newMixCascade) |
private java.lang.Thread |
startInitThread(ExceptionVariable retVar,
MixCascade nextCascade,
boolean a_bKeepCurrentService,
boolean a_bReconnect) |
void |
stop() |
protected void |
transferredBytes(long bytes,
int protocolType)
Lets a potential
IProxyListener object know, how many bytes of
which type of protocol have been sent. |
public static final int UNLIMITED_REQUESTS
public static final int MIN_REQUESTS
public static final int E_MIX_PROTOCOL_NOT_SUPPORTED
public static final int E_SIGNATURE_CHECK_FIRSTMIX_FAILED
public static final int E_SIGNATURE_CHECK_OTHERMIX_FAILED
private static final int RECONNECT_INTERVAL
private int m_maxRequests
private int m_socketGuardTimeout
private AnonClient m_Anon
private AnonService m_Tor
private AnonService m_Mixminion
private java.util.Vector m_anonServiceListener
private java.lang.Thread threadRunOne
private java.lang.Thread threadRunTwo
private final java.lang.Object SYNC_THREAD_RUN
private java.lang.Thread m_tInit
private java.net.ServerSocket m_socketListener
private java.net.ServerSocket m_socketListenerTwo
private IMutableProxyInterface m_proxyInterface
private IProxyListener m_ProxyListener
private volatile int m_numChannels
private boolean m_bReconnecting
private boolean m_bConnecting
private final java.lang.Object THREAD_SYNC
private final java.lang.Object SHUTDOWN_SYNC
private boolean m_bShuttingDown
private ProxyCallbackHandler m_callbackHandler
private final java.lang.Object SYNC_CALLBACK_HANDLER
private final HTTPProxyCallback m_httpProxyCallback
private DecompressionProxyCallback m_decompressionProxyCallback
private TermsAndConditionConfirmation termsConfirmation
private AbstractMixCascadeContainer m_containerMixCascade
private java.util.Observer m_observer
private boolean m_bWeChanged
private TorAnonServerDescription m_currentTorParams
private MixminionServiceDescription m_currentMixminionParams
private boolean m_forwardedConnection
private int m_maxDummyTrafficInterval
private final java.util.Vector m_currentStartThreads
public AnonProxy(java.net.ServerSocket a_listener, TermsAndConditionConfirmation termsConfirmation, int a_socketTimeout)
a_listener
- A ServerSocket, where the AnonProxy listens for new requests
(e.g. from a web browser).setTorParams()
,
setMixminionParams()
public AnonProxy(DirectProxy a_directProxy, IMutableProxyInterface a_proxyInterface, TermsAndConditionConfirmation termsConfirmation)
public AnonProxy(java.net.ServerSocket a_listener, IMutableProxyInterface a_proxyInterface, TermsAndConditionConfirmation termsConfirmation)
a_listener
- A ServerSocket, where the AnonProxy listens for new requests
(e.g. from a web browser).a_proxyInterface
- describes a proxy the AnonProxy should use to establish
connections to the anon servers (e.g. if you are behind some
firewall etc.)setTorParams()
,
setMixminionParams()
private AnonProxy(DirectProxy a_directProxy, java.net.ServerSocket a_listener, IMutableProxyInterface a_proxyInterface, TermsAndConditionConfirmation termsConfirmation)
public AnonProxy(DirectProxy a_directProxy, IStreamConnection a_proxyConnection, MixCascade a_currentService, int a_maxDummyTrafficInterval, TermsAndConditionConfirmation termsConfirmation)
a_directProxy
- A DirectProxy
, from which to get the
ServerSocket
objects to listen for requests on.a_proxyConnection
- An already open connection to a mix (but not initialized, like
keys exchanged, ...).a_currentService
- a_maxDummyTrafficInterval
- The minimum dummy traffic rate the connection needs. The value
is the maximum dummy traffic interval in milliseconds. Any call
of setDummyTraffic(), will respect this maximum interval value
-> bigger values set with setDummyTraffic (especially -1) result
in that maximum dummy traffic interval value. If this value is
-1, there is no need for dummy traffic on that connection on the
server side.termsConfirmation
- private void enableProxyCallback(ProxyCallback callback)
private void disableProxyCallback(ProxyCallback callback)
public void setHTTPHeaderProcessingEnabled(boolean enable, boolean b_force_proxy_callback)
public void setHTTPDecompressionEnabled(boolean enable)
public void removeHTTPConnectionListener(AbstractHTTPConnectionListener listener)
public void addHTTPConnectionListener(AbstractHTTPConnectionListener listener)
public MixCascade getMixCascade()
public void setTorParams(TorAnonServerDescription newTorParams)
newTorParams
- The new parameters for TOR.TorAnonServerDescription
public TorAnonServerDescription getTorParams()
public void setMixminionParams(MixminionServiceDescription newMixminionParams)
newMixminionParams
- The new parameters for Mixminion. If NULL the Mixminion proxy is
disabled.MixminionServiceDescription
public MixminionServiceDescription getMixminionParams()
public void setMaxConcurrentRequests(int a_maxRequests)
public int getMaxConcurrentRequests()
public void setDummyTraffic(int a_interval)
a_interval
- The interval for dummy traffic on the connection to the server
in milliseconds.public void setInterfaceBlockTimeout(long a_msTimeout)
public void setDebug(boolean bDebug)
public void stop()
AnonChannel createChannel(int type) throws java.net.ConnectException
AnonService
. It can be used to write and receive
data.type
- Type of channel. See AnonChannel
AnonChannel
object.java.net.ConnectException
- If channel creation fails.void reconnect()
public void setProxyListener(IProxyListener l)
private boolean interruptInit(java.lang.Thread a_tInit)
public int countStartThreads()
public void start(AbstractMixCascadeContainer a_newMixCascade) throws AnonServiceException
AnonServiceException
private void joinInitThread(java.lang.Thread tInit, ExceptionVariable retVar)
private void finishInitThread(MixCascade currentCascade, ExceptionVariable retVar, java.lang.Thread tInit)
private java.lang.Thread startInitThread(ExceptionVariable retVar, MixCascade nextCascade, boolean a_bKeepCurrentService, boolean a_bReconnect)
private void start_internal(AbstractMixCascadeContainer a_newMixCascade) throws AnonServiceException
AnonServiceException
protected void decNumChannels()
IProxyListener
objects registered to this AnonProxy
.protected void incNumChannels()
IProxyListener
objects registered to this AnonProxy
.protected void transferredBytes(long bytes, int protocolType)
IProxyListener
object know, how many bytes of
which type of protocol have been sent.bytes
- protocolType
- private void fireDisconnected()
private void fireConnecting(AnonServerDescription a_serverDescription, boolean a_bIsReconnect)
private void fireCurrentServiceChanged(AnonServerDescription a_serverDescription)
private void fireConnectionEstablished(AnonServerDescription a_serverDescription)
public void connecting(AnonServerDescription a_serverDescription, boolean a_bIsReconnect)
connecting
in interface AnonServiceEventListener
public void currentServiceChanged(AnonServerDescription a_serverDescription)
currentServiceChanged
in interface AnonServiceEventListener
public void connectionEstablished(AnonServerDescription a_serverDescription)
connectionEstablished
in interface AnonServiceEventListener
public void disconnected()
disconnected
in interface AnonServiceEventListener
public void connectionError(AnonServiceException a_e)
connectionError
in interface AnonServiceEventListener
public void addEventListener(AnonServiceEventListener l)
public void removeEventListener(AnonServiceEventListener l)
public boolean isConnected()
public boolean isConnecting()
public void packetMixed(long a_totalBytes)
packetMixed
in interface AnonServiceEventListener
public void dataChainErrorSignaled(AnonServiceException a_e)
dataChainErrorSignaled
in interface AnonServiceEventListener
public void integrityErrorSignaled(AnonServiceException a_e)
integrityErrorSignaled
in interface AnonServiceEventListener
Copyright © 2023. All rights reserved.