|
|||||||||
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)
gets a circuit for the given host and port |
java.util.Vector |
getFirstOnionRouterList()
returns a list of all onion routers that are allowed at the moment as first onion routers |
static Tor |
getInstance()
Returns a Instance of Tor |
java.util.Vector |
getOnionRouterList()
returns a list of all onionrouters |
IMutableProxyInterface |
getProxy()
|
int |
initialize(AnonServerDescription torDirServer,
IServiceContainer a_serviceContainer)
Initializes this AnonService. |
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 an IP to a given hostname |
void |
run()
creates new circuits |
private void |
setCircuitLength(int min,
int max)
sets a circuit length |
private void |
setConnectionsPerRoute(int i)
Set the total number of allowed different connections per route |
void |
setExitNodes(java.util.Vector listOfORNames)
sets a List of allowed exit nodes. |
void |
setFirstOnionRouterList(java.util.Vector listOfORNames)
sets a List of allowed Onion Routers that are used as entry point to the Tor Network |
void |
setOnionRouterList(java.util.Vector listOfORNames)
sets a List of allowed middle Onion Routers |
private void |
setORListServer(boolean bUseInfoService,
java.lang.String name,
int port)
sets the server where the onionrouterlist is fetched |
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 use of the DNS-Cache |
void |
shutdown()
shutdown tor |
private void |
start(boolean startCircuits)
starts the Tor-Service |
private void |
stop()
stops the Tor-Service and all opened connections |
void |
testDNS()
test the DNS-resolve mechanism |
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)
addr
- host addressport
- host port
private Circuit createNewCircuit(java.lang.String addr, int port)
public 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()
public void setOnionRouterList(java.util.Vector listOfORNames)
ORList
- List of the names of allowed Onion Routers
if ORList is null, then all OR's are usedpublic void setFirstOnionRouterList(java.util.Vector listOfORNames)
FORList
- List of Onion Routers, if null all are allowedpublic void setExitNodes(java.util.Vector listOfORNames)
exitNodes
- List of exit nodesprivate 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 java.util.Vector getOnionRouterList()
public java.util.Vector getFirstOnionRouterList()
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.io.IOException
java.net.ConnectException
public int initialize(AnonServerDescription torDirServer, IServiceContainer a_serviceContainer)
AnonService
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()
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 void testDNS() throws java.lang.Exception
java.lang.Exception
public boolean isConnected()
AnonService
isConnected
in interface AnonService
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |