net.i2p.i2ptunnel

## Class TunnelController

- java.lang.Object
- - net.i2p.i2ptunnel.TunnelController

- All Implemented Interfaces:
    Logging

      public class TunnelController
      extends Object
      implements Logging

  Coordinate the runtime operation and configuration of a tunnel. These objects are bundled together under a TunnelControllerGroup where the entire group is stored / loaded from a single config file.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `TunnelController(Properties config, String prefix)` Create a new controller for a tunnel out of the specific config options.
    `TunnelController(Properties config, String prefix, boolean createKey)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `List<String>` | `clearMessages()` Pull off any messages that the I2PTunnel has produced
    `String` | `getClientOptions()`
    `Properties` | `getConfig(String prefix)`
    `String` | `getDescription()`
    `String` | `getI2CPHost()`
    `String` | `getI2CPPort()`
    `boolean` | `getIsRunning()`
    `boolean` | `getIsStandby()` if running but no open sessions, we are in standby
    `boolean` | `getIsStarting()`
    `String` | `getListenOnInterface()`
    `String` | `getListenPort()`
    `String` | `getMyDestHashBase32()`
    `String` | `getMyDestination()`
    `String` | `getName()`
    `boolean` | `getPersistentClientKey()`
    `String` | `getPrivKeyFile()`
    `String` | `getProxyList()`
    `String` | `getSharedClient()` default true
    `String` | `getSpoofedHost()`
    `boolean` | `getStartOnLoad()` default true
    `void` | `getSummary(StringBuilder buf)`
    `String` | `getTargetDestination()`
    `String` | `getTargetHost()`
    `String` | `getTargetPort()`
    `String` | `getType()`
    `void` | `log(String s)`
    `void` | `restartTunnel()`
    `void` | `setConfig(Properties config, String prefix)`
    `void` | `startTunnel()` Start up the tunnel (if it isn't already running)
    `void` | `startTunnelBackground()`
    `void` | `stopTunnel()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### TunnelController

          public TunnelController(Properties config,
                          String prefix)

      Create a new controller for a tunnel out of the specific config options. The config may contain a large number of options - only ones that begin in the prefix should be used (and, in turn, that prefix should be stripped off before being interpreted by this controller)
      Parameters:
        `config` - original key=value mapping
        `prefix` - beginning of key values that are relevent to this tunnel

    - #### TunnelController

          public TunnelController(Properties config,
                          String prefix,
                          boolean createKey)

      Parameters:
        `createKey` - for servers, whether we want to create a brand new destination with private keys at the location specified or not (does not overwrite existing ones)

  - ### Method Detail

    - #### startTunnelBackground

          public void startTunnelBackground()

    - #### startTunnel

          public void startTunnel()

      Start up the tunnel (if it isn't already running)

    - #### stopTunnel

          public void stopTunnel()

    - #### restartTunnel

          public void restartTunnel()

    - #### setConfig

          public void setConfig(Properties config,
                       String prefix)

    - #### getConfig

          public Properties getConfig(String prefix)

    - #### getType

          public String getType()

    - #### getName

          public String getName()

    - #### getDescription

          public String getDescription()

    - #### getI2CPHost

          public String getI2CPHost()

    - #### getI2CPPort

          public String getI2CPPort()

    - #### getClientOptions

          public String getClientOptions()

    - #### getListenOnInterface

          public String getListenOnInterface()

    - #### getTargetHost

          public String getTargetHost()

    - #### getTargetPort

          public String getTargetPort()

    - #### getSpoofedHost

          public String getSpoofedHost()

    - #### getPrivKeyFile

          public String getPrivKeyFile()

    - #### getListenPort

          public String getListenPort()

    - #### getTargetDestination

          public String getTargetDestination()

    - #### getProxyList

          public String getProxyList()

    - #### getSharedClient

          public String getSharedClient()

      default true

    - #### getStartOnLoad

          public boolean getStartOnLoad()

      default true

    - #### getPersistentClientKey

          public boolean getPersistentClientKey()

    - #### getMyDestination

          public String getMyDestination()

    - #### getMyDestHashBase32

          public String getMyDestHashBase32()

    - #### getIsRunning

          public boolean getIsRunning()

    - #### getIsStarting

          public boolean getIsStarting()

    - #### getIsStandby

          public boolean getIsStandby()

      if running but no open sessions, we are in standby

    - #### getSummary

          public void getSummary(StringBuilder buf)

    - #### log

          public void log(String s)

      Specified by:
        `log` in interface `Logging`

    - #### clearMessages

          public List<String> clearMessages()

      Pull off any messages that the I2PTunnel has produced
      Returns:
        list of messages pulled off (each is a String, earliest first)