|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object anon.tor.Tor
public class Tor
Fields inherited from interface anon.AnonService |
---|
ANONLIB_VERSION |
Constructor Summary | |
---|---|
private |
Tor()
Constructor initialize variables |
Method Summary | |
---|---|
void |
addEventListener(AnonServiceEventListener l)
Adds an AnonServiceEventListener. |
AnonChannel |
createChannel(int type)
creates a channel through the tor network |
AnonChannel |
createChannel(java.lang.String addr,
int port)
creates a channel through the Tor network |
private Circuit |
createNewCircuit(java.lang.String addr,
int port)
creates a new random circuit for the given destination |
protected Circuit |
getCircuitForDestination(java.lang.String addr,
int port,
java.util.Hashtable exludeCircuits)
gets a circuit for the given host and port |
static Tor |
getInstance()
returns an instance of Tor |
IMutableProxyInterface |
getProxy()
|
int |
initialize(AnonServerDescription torDirServer,
IServiceContainer a_serviceContainer,
TermsAndConditionConfirmation termsConfirmation)
initializes Tor service |
boolean |
isConnected()
Returns true if this Anon Service is connected, e.g. |
void |
removeEventListener(AnonServiceEventListener l)
Removes an AnonServiceEventListener. |
void |
removeEventListeners()
|
java.lang.String |
resolveDNS(java.lang.String name)
resolves a given hostname to an IP |
void |
run()
thread creating new circuits |
private void |
setCircuitLength(int min,
int max)
sets a circuit length |
private void |
setConnectionsPerRoute(int i)
sets the total number of allowed different connections per route |
private void |
setORListServer(boolean bUseInfoService,
java.lang.String name,
int port)
sets the server the list of onionrouters is fetched from |
int |
setProxy(IMutableProxyInterface a_Proxy)
Sets the settings ofr the proxy, which should be used to establish network connections |
void |
setUseDNSCache(boolean usecache)
active/deactivate the DNS cache |
void |
shutdown(boolean a_bResetTransferredBytes)
shutdown tor |
private void |
start(boolean startCircuits)
starts the Tor service |
private void |
stop()
stops the Tor service and closes all connections |
private void |
updateORList()
updates the ORList |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int MAX_ROUTE_LEN
public static final int MIN_ROUTE_LEN
public static final int DNS_TIME_OUT
private static Tor ms_theTorInstance
private ORList m_orList
private java.util.Vector m_allowedORNames
private java.util.Vector m_allowedFirstORNames
private java.util.Vector m_allowedExitNodeNames
private Circuit[] m_activeCircuits
private int m_MaxNrOfActiveCircuits
private java.lang.Object m_oActiveCircuitSync
private java.lang.Object m_oStartStopSync
private FirstOnionRouterConnectionFactory m_firstORFactory
private Database m_DNSCache
private java.util.Hashtable m_CircuitForDestination
private java.util.Vector[] m_KeysForCircuit
private volatile boolean m_bIsStarted
private boolean m_bIsCreatingCircuit
private boolean m_useDNSCache
private int m_circuitLengthMin
private int m_circuitLengthMax
private int m_ConnectionsPerCircuit
private MyRandom m_rand
public static final java.lang.String DEFAULT_DIR_SERVER_ADDR
public static final int DEFAULT_DIR_SERVER_PORT
private java.lang.Thread m_circuitCreator
private volatile boolean m_bCloseCreator
private IMutableProxyInterface m_proxyInterface
Constructor Detail |
---|
private Tor()
Method Detail |
---|
private void updateORList()
protected Circuit getCircuitForDestination(java.lang.String addr, int port, java.util.Hashtable exludeCircuits)
addr
- host addressport
- host portexludeCircuits
- Contains circuits, which should not be considered
when finding an appropirated circuit for the given destination. Can be NULL or empty
private Circuit createNewCircuit(java.lang.String addr, int port)
addr
- addressport
- portpublic static Tor getInstance()
public void run()
run
in interface java.lang.Runnable
private void start(boolean startCircuits) throws java.io.IOException
startCircuits
- create all circuits at startup
java.io.IOException
private void stop()
private void setCircuitLength(int min, int max)
min
- minimum circuit lengthmax
- maximum circuit lengthprivate void setConnectionsPerRoute(int i)
private void setORListServer(boolean bUseInfoService, java.lang.String name, int port)
name
- addressport
- portpublic void setUseDNSCache(boolean usecache)
usecache
- public AnonChannel createChannel(int type) throws java.net.ConnectException
createChannel
in interface AnonService
type
- channeltype (only AnonChannel.SOCKS is supported at the moment)
java.io.IOException
java.net.ConnectException
public AnonChannel createChannel(java.lang.String addr, int port) throws java.net.ConnectException
addr
- addressport
- port
java.net.ConnectException
public int initialize(AnonServerDescription torDirServer, IServiceContainer a_serviceContainer, TermsAndConditionConfirmation termsConfirmation)
initialize
in interface AnonService
torDirServer
- AnonServer to use
public int setProxy(IMutableProxyInterface a_Proxy)
AnonService
setProxy
in interface AnonService
public IMutableProxyInterface getProxy()
public void shutdown(boolean a_bResetTransferredBytes)
shutdown
in interface AnonService
public void addEventListener(AnonServiceEventListener l)
AnonService
AnonServiceEventListener
.
addEventListener
in interface AnonService
l
- Listener to addpublic void removeEventListeners()
removeEventListeners
in interface AnonService
public void removeEventListener(AnonServiceEventListener l)
AnonService
removeEventListener
in interface AnonService
l
- Listener, which will be removedpublic java.lang.String resolveDNS(java.lang.String name)
name
- hostname
public boolean isConnected()
AnonService
isConnected
in interface AnonService
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |