Class WindowsTorWrapper

java.lang.Object
org.briarproject.onionwrapper.WindowsTorWrapper
All Implemented Interfaces:
net.freehaven.tor.control.EventHandler, org.briarproject.onionwrapper.TorWrapper

@NotNullByDefault public class WindowsTorWrapper extends Object
A Tor wrapper for the Windows operating system.
  • Field Details

    • ioExecutor

      protected final Executor ioExecutor
    • eventExecutor

      protected final Executor eventExecutor
    • state

      protected final org.briarproject.onionwrapper.AbstractTorWrapper.NetworkState state
  • Constructor Details

    • WindowsTorWrapper

      public WindowsTorWrapper(Executor ioExecutor, Executor eventExecutor, String architecture, File torDirectory, int torSocksPort, int torControlPort)
      Parameters:
      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 the observer (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 Details

    • getProcessId

      protected int getProcessId()
    • waitForTorToStart

      protected void waitForTorToStart(Process torProcess) throws InterruptedException, IOException
      Throws:
      InterruptedException
      IOException
    • getExecutableExtension

      protected String getExecutableExtension()
    • getLastUpdateTime

      protected long getLastUpdateTime()
    • getResourceInputStream

      protected InputStream getResourceInputStream(String name, String extension)
    • getTorExecutableFile

      protected File getTorExecutableFile()
    • getLibEventFile

      protected File getLibEventFile()
    • getObfs4ExecutableFile

      protected File getObfs4ExecutableFile()
    • getSnowflakeExecutableFile

      protected File getSnowflakeExecutableFile()
    • setObserver

      public void setObserver(@Nullable org.briarproject.onionwrapper.TorWrapper.Observer arg0)
      Specified by:
      setObserver in interface org.briarproject.onionwrapper.TorWrapper
    • start

      public void start() throws IOException, InterruptedException
      Specified by:
      start in interface org.briarproject.onionwrapper.TorWrapper
      Throws:
      IOException
      InterruptedException
    • extract

      protected void extract(InputStream arg0, File arg1) throws IOException
      Throws:
      IOException
    • installTorExecutable

      protected void installTorExecutable() throws IOException
      Throws:
      IOException
    • installLibEvent

      protected void installLibEvent() throws IOException
      Throws:
      IOException
    • installObfs4Executable

      protected void installObfs4Executable() throws IOException
      Throws:
      IOException
    • installSnowflakeExecutable

      protected void installSnowflakeExecutable() throws IOException
      Throws:
      IOException
    • publishHiddenService

      public org.briarproject.onionwrapper.TorWrapper.HiddenServiceProperties publishHiddenService(int arg0, int arg1, @Nullable String arg2) throws IOException
      Specified by:
      publishHiddenService in interface org.briarproject.onionwrapper.TorWrapper
      Throws:
      IOException
    • removeHiddenService

      public void removeHiddenService(String arg0) throws IOException
      Specified by:
      removeHiddenService in interface org.briarproject.onionwrapper.TorWrapper
      Throws:
      IOException
    • enableNetwork

      public void enableNetwork(boolean arg0) throws IOException
      Specified by:
      enableNetwork in interface org.briarproject.onionwrapper.TorWrapper
      Throws:
      IOException
    • enableBridges

      public void enableBridges(List<String> arg0) throws IOException
      Specified by:
      enableBridges in interface org.briarproject.onionwrapper.TorWrapper
      Throws:
      IOException
    • disableBridges

      public void disableBridges() throws IOException
      Specified by:
      disableBridges in interface org.briarproject.onionwrapper.TorWrapper
      Throws:
      IOException
    • stop

      public void stop() throws IOException
      Specified by:
      stop in interface org.briarproject.onionwrapper.TorWrapper
      Throws:
      IOException
    • circuitStatus

      public void circuitStatus(String arg0, String arg1, String arg2)
      Specified by:
      circuitStatus in interface net.freehaven.tor.control.EventHandler
    • streamStatus

      public void streamStatus(String arg0, String arg1, String arg2)
      Specified by:
      streamStatus in interface net.freehaven.tor.control.EventHandler
    • orConnStatus

      public void orConnStatus(String arg0, String arg1)
      Specified by:
      orConnStatus in interface net.freehaven.tor.control.EventHandler
    • bandwidthUsed

      public void bandwidthUsed(long arg0, long arg1)
      Specified by:
      bandwidthUsed in interface net.freehaven.tor.control.EventHandler
    • newDescriptors

      public void newDescriptors(List<String> arg0)
      Specified by:
      newDescriptors in interface net.freehaven.tor.control.EventHandler
    • message

      public void message(String arg0, String arg1)
      Specified by:
      message in interface net.freehaven.tor.control.EventHandler
    • unrecognized

      public void unrecognized(String arg0, String arg1)
      Specified by:
      unrecognized in interface net.freehaven.tor.control.EventHandler
    • controlConnectionClosed

      public void controlConnectionClosed()
      Specified by:
      controlConnectionClosed in interface net.freehaven.tor.control.EventHandler
    • enableConnectionPadding

      public void enableConnectionPadding(boolean arg0) throws IOException
      Specified by:
      enableConnectionPadding in interface org.briarproject.onionwrapper.TorWrapper
      Throws:
      IOException
    • enableIpv6

      public void enableIpv6(boolean arg0) throws IOException
      Specified by:
      enableIpv6 in interface org.briarproject.onionwrapper.TorWrapper
      Throws:
      IOException
    • getTorState

      public org.briarproject.onionwrapper.TorWrapper.TorState getTorState()
      Specified by:
      getTorState in interface org.briarproject.onionwrapper.TorWrapper
    • isTorRunning

      public boolean isTorRunning()
      Specified by:
      isTorRunning in interface org.briarproject.onionwrapper.TorWrapper