Package org.briarproject.onionwrapper
Class AndroidTorWrapper
- java.lang.Object
-
- org.briarproject.onionwrapper.AndroidTorWrapper
-
- All Implemented Interfaces:
net.freehaven.tor.control.EventHandler,org.briarproject.onionwrapper.TorWrapper
@NotNullByDefault public class AndroidTorWrapper extends Object
A Tor wrapper for the Android operating system.
-
-
Field Summary
Fields Modifier and Type Field Description protected ExecutoreventExecutorprotected ExecutorioExecutorprotected org.briarproject.onionwrapper.AbstractTorWrapper.NetworkStatestate
-
Constructor Summary
Constructors Constructor Description AndroidTorWrapper(Application app, org.briarproject.android.dontkillmelib.wakelock.AndroidWakeLockManager wakeLockManager, Executor ioExecutor, Executor eventExecutor, String architecture, File torDirectory, int torSocksPort, int torControlPort)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbandwidthUsed(long arg0, long arg1)voidcircuitStatus(String arg0, String arg1, String arg2)voidcontrolConnectionClosed()voiddisableBridges()voidenableBridges(List<String> arg0)voidenableConnectionPadding(boolean arg0)voidenableIpv6(boolean arg0)voidenableNetwork(boolean enable)protected voidextract(InputStream arg0, File arg1)protected StringgetExecutableExtension()protected longgetLastUpdateTime()FilegetObfs4ExecutableFile()protected intgetProcessId()InputStreamgetResourceInputStream(String name, String extension)protected FilegetSnowflakeExecutableFile()protected FilegetTorExecutableFile()org.briarproject.onionwrapper.TorWrapper.TorStategetTorState()protected voidinstallObfs4Executable()protected voidinstallSnowflakeExecutable()protected voidinstallTorExecutable()booleanisTorRunning()voidmessage(String arg0, String arg1)voidnewDescriptors(List<String> arg0)voidorConnStatus(String arg0, String arg1)org.briarproject.onionwrapper.TorWrapper.HiddenServicePropertiespublishHiddenService(int arg0, int arg1, String arg2)voidremoveHiddenService(String arg0)voidsetObserver(org.briarproject.onionwrapper.TorWrapper.Observer arg0)voidstart()voidstop()voidstreamStatus(String arg0, String arg1, String arg2)voidunrecognized(String arg0, String arg1)protected voidwaitForTorToStart(Process arg0)
-
-
-
Constructor Detail
-
AndroidTorWrapper
public AndroidTorWrapper(Application app, org.briarproject.android.dontkillmelib.wakelock.AndroidWakeLockManager wakeLockManager, Executor ioExecutor, Executor eventExecutor, String architecture, File torDirectory, int torSocksPort, int torControlPort)
- Parameters:
app- The application instance.wakeLockManager- The interface for managing a shared wake lock.ioExecutor- The wrapper will use this executor to run IO tasks, some of which may run for the lifetime of the wrapper, so the executor should have an unlimited thread pool.eventExecutor- The wrapper will use this executor to call theobserver(if any). To ensure that events are observed in the order they occur, this executor should have a single thread (eg the app's main thread).architecture- The processor architecture of the Tor and pluggable transport binaries.torDirectory- The directory where the Tor process should keep its state.torSocksPort- The port number to use for Tor's SOCKS port.torControlPort- The port number to use for Tor's control port.
-
-
Method Detail
-
getProcessId
protected int getProcessId()
-
getLastUpdateTime
protected long getLastUpdateTime()
-
getResourceInputStream
public InputStream getResourceInputStream(String name, String extension)
-
enableNetwork
public void enableNetwork(boolean enable) throws IOException- Specified by:
enableNetworkin interfaceorg.briarproject.onionwrapper.TorWrapper- Throws:
IOException
-
stop
public void stop() throws IOException, InterruptedException- Specified by:
stopin interfaceorg.briarproject.onionwrapper.TorWrapper- Throws:
IOExceptionInterruptedException
-
getTorExecutableFile
protected File getTorExecutableFile()
-
getObfs4ExecutableFile
public File getObfs4ExecutableFile()
- Specified by:
getObfs4ExecutableFilein interfaceorg.briarproject.onionwrapper.TorWrapper
-
getSnowflakeExecutableFile
protected File getSnowflakeExecutableFile()
-
installTorExecutable
protected void installTorExecutable() throws IOException- Throws:
IOException
-
installObfs4Executable
protected void installObfs4Executable() throws IOException- Throws:
IOException
-
installSnowflakeExecutable
protected void installSnowflakeExecutable() throws IOException- Throws:
IOException
-
setObserver
public void setObserver(@Nullable org.briarproject.onionwrapper.TorWrapper.Observer arg0)- Specified by:
setObserverin interfaceorg.briarproject.onionwrapper.TorWrapper
-
start
public void start() throws IOException, InterruptedException- Specified by:
startin interfaceorg.briarproject.onionwrapper.TorWrapper- Throws:
IOExceptionInterruptedException
-
extract
protected void extract(InputStream arg0, File arg1) throws IOException
- Throws:
IOException
-
getExecutableExtension
protected String getExecutableExtension()
-
waitForTorToStart
protected void waitForTorToStart(Process arg0) throws InterruptedException, IOException
- Throws:
InterruptedExceptionIOException
-
publishHiddenService
public org.briarproject.onionwrapper.TorWrapper.HiddenServiceProperties publishHiddenService(int arg0, int arg1, @Nullable String arg2) throws IOException- Specified by:
publishHiddenServicein interfaceorg.briarproject.onionwrapper.TorWrapper- Throws:
IOException
-
removeHiddenService
public void removeHiddenService(String arg0) throws IOException
- Specified by:
removeHiddenServicein interfaceorg.briarproject.onionwrapper.TorWrapper- Throws:
IOException
-
enableBridges
public void enableBridges(List<String> arg0) throws IOException
- Specified by:
enableBridgesin interfaceorg.briarproject.onionwrapper.TorWrapper- Throws:
IOException
-
disableBridges
public void disableBridges() throws IOException- Specified by:
disableBridgesin interfaceorg.briarproject.onionwrapper.TorWrapper- Throws:
IOException
-
circuitStatus
public void circuitStatus(String arg0, String arg1, String arg2)
- Specified by:
circuitStatusin interfacenet.freehaven.tor.control.EventHandler
-
streamStatus
public void streamStatus(String arg0, String arg1, String arg2)
- Specified by:
streamStatusin interfacenet.freehaven.tor.control.EventHandler
-
orConnStatus
public void orConnStatus(String arg0, String arg1)
- Specified by:
orConnStatusin interfacenet.freehaven.tor.control.EventHandler
-
bandwidthUsed
public void bandwidthUsed(long arg0, long arg1)- Specified by:
bandwidthUsedin interfacenet.freehaven.tor.control.EventHandler
-
newDescriptors
public void newDescriptors(List<String> arg0)
- Specified by:
newDescriptorsin interfacenet.freehaven.tor.control.EventHandler
-
message
public void message(String arg0, String arg1)
- Specified by:
messagein interfacenet.freehaven.tor.control.EventHandler
-
unrecognized
public void unrecognized(String arg0, String arg1)
- Specified by:
unrecognizedin interfacenet.freehaven.tor.control.EventHandler
-
controlConnectionClosed
public void controlConnectionClosed()
- Specified by:
controlConnectionClosedin interfacenet.freehaven.tor.control.EventHandler
-
enableConnectionPadding
public void enableConnectionPadding(boolean arg0) throws IOException- Specified by:
enableConnectionPaddingin interfaceorg.briarproject.onionwrapper.TorWrapper- Throws:
IOException
-
enableIpv6
public void enableIpv6(boolean arg0) throws IOException- Specified by:
enableIpv6in interfaceorg.briarproject.onionwrapper.TorWrapper- Throws:
IOException
-
getTorState
public org.briarproject.onionwrapper.TorWrapper.TorState getTorState()
- Specified by:
getTorStatein interfaceorg.briarproject.onionwrapper.TorWrapper
-
isTorRunning
public boolean isTorRunning()
- Specified by:
isTorRunningin interfaceorg.briarproject.onionwrapper.TorWrapper
-
-