Interface TorWrapper


@NotNullByDefault public interface TorWrapper
  • Field Details

    • LOG

      static final Logger LOG
  • Method Details

    • start

      void start() throws IOException, InterruptedException
      Starts the Tor process.

      This method must only be called once. To restart the Tor process, stop this wrapper instance and then create a new instance.

      Throws:
      IOException
      InterruptedException
    • stop

      void stop() throws IOException
      Tell the Tor process to stop and returns without waiting for the process to exit.
      Throws:
      IOException
    • setObserver

      void setObserver(@Nullable TorWrapper.Observer observer)
      Sets an observer for observing the state of the wrapper, replacing any existing observer, or removes any existing observer if the argument is null.
    • getTorState

      TorWrapper.TorState getTorState()
      Returns the current state of the wrapper.
    • isTorRunning

      boolean isTorRunning()
      Returns true if the wrapper has been started and not yet stop() stopped.
    • publishHiddenService

      TorWrapper.HiddenServiceProperties publishHiddenService(int localPort, int remotePort, @Nullable String privateKey) throws IOException
      Publishes an ephemeral hidden service.
      Parameters:
      localPort - The local port on which the service is listening.
      remotePort - The port number that clients of the service will see.
      privateKey - The private key of the hidden service, in the form returned by a previous call to this method, or null if a new service should be created.
      Throws:
      IOException
    • removeHiddenService

      void removeHiddenService(String onion) throws IOException
      Removes (unpublishes) an ephemeral hidden service that was created by calling publishHiddenService(int, int, String).
      Throws:
      IOException
    • enableNetwork

      void enableNetwork(boolean enable) throws IOException
      Enables or disables the Tor process's network connection. The network connection is disabled by default.
      Throws:
      IOException
    • enableBridges

      void enableBridges(List<String> bridges) throws IOException
      Configures Tor to use the given list of bridges for connecting to the Tor network. Bridges are not used by default.

      Each item in the list should be a bridge line in the same format that would be used in a torrc file (including the Bridge keyword).

      Throws:
      IOException
    • disableBridges

      void disableBridges() throws IOException
      Configures Tor not to use bridges for connecting to the Tor network. Bridges are not used by default.
      Throws:
      IOException
    • enableConnectionPadding

      void enableConnectionPadding(boolean enable) throws IOException
      Enables or disables connection padding. Padding is disabled by default.
      Throws:
      IOException
    • enableIpv6

      void enableIpv6(boolean ipv6Only) throws IOException
      Configures Tor to use IPv6 or IPv4 for connecting to the Tor network. IPv4 is used by default.
      Throws:
      IOException