public class TorProxy
extends java.lang.Object
| Constructor and Description |
|---|
TorProxy(java.io.File torPath)
Create a new Tor proxy instance.
|
TorProxy(java.io.File torPath,
int port)
Create a new Tor proxy instance.
|
TorProxy(java.io.File torPath,
int port,
int controlPort)
Create a new Tor proxy instance.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getControlPort() |
int |
getPort() |
int |
getStartProgress() |
java.io.File |
getTorPath() |
boolean |
isRunning() |
boolean |
isStarted() |
void |
kill()
Kill the Tor process.
This does nothing if the Tor process is not running. |
boolean |
reconnect()
Reconnect to the Tor network.
This will change the external IP address of the proxy. |
void |
start()
Start the Tor process.
A new thread will be started to listen for the start progress. |
void |
stop()
Stop the Tor process.
|
public TorProxy(java.io.File torPath)
torPath - Path to the Tor executablepublic TorProxy(java.io.File torPath,
int port)
torPath - Path to the Tor executableport - The port the proxy should listen onpublic TorProxy(java.io.File torPath,
int port,
int controlPort)
torPath - Path to the Tor executableport - The port the proxy should listen oncontrolPort - The port the control server should listen onpublic java.io.File getTorPath()
public int getPort()
public int getControlPort()
public int getStartProgress()
public boolean isRunning()
public boolean isStarted()
public void start()
throws java.io.IOException
java.lang.IllegalStateException - If the Tor process is already runningjava.io.IOException - If the Tor process could not be startedpublic void stop()
java.lang.IllegalStateException - If the Tor process is not runningpublic void kill()
public boolean reconnect()
throws java.io.IOException
java.io.IOException - If the control communication failed