net.i2p.i2ptunnel
Class TunnelController

java.lang.Object
  extended by net.i2p.i2ptunnel.TunnelController
All Implemented Interfaces:
Logging

public class TunnelController
extends Object
implements Logging

Coordinate the runtime operation and configuration of a single I2PTunnel. An I2PTunnel tracks one or more I2PTunnelTasks and one or more I2PSessions. Usually one of each. These objects are bundled together under a TunnelControllerGroup where the entire group is stored / loaded from a single config file. This is the class used by several plugins to create tunnels, so take care to maintain the public methods as a stable API.


Constructor Summary
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
 List<String> clearMessages()
          Pull off any messages that the I2PTunnel has produced
 Properties getClientOptionProps()
          These are the ones stored with a prefix of "option."
 String getClientOptions()
          Deprecated. why would you want this? Use getClientOptionProps() instead
 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)
          Deprecated. unused
 String getTargetDestination()
           
 String getTargetHost()
           
 String getTargetPort()
           
 String getType()
           
 void log(String s)
           
 void restartTunnel()
           
 void setConfig(Properties config, String prefix)
          As of 0.9.1, updates the options on an existing session
 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)


getClientOptionProps

public Properties getClientOptionProps()
These are the ones stored with a prefix of "option."

Returns:
keys with the "option." prefix stripped
Since:
0.9.1 Much better than getClientOptions()

stopTunnel

public void stopTunnel()

restartTunnel

public void restartTunnel()

setConfig

public void setConfig(Properties config,
                      String prefix)
As of 0.9.1, updates the options on an existing session


getConfig

public Properties getConfig(String prefix)
Returns:
a copy

getType

public String getType()

getName

public String getName()

getDescription

public String getDescription()

getI2CPHost

public String getI2CPHost()

getI2CPPort

public String getI2CPPort()

getClientOptions

public String getClientOptions()
Deprecated. why would you want this? Use getClientOptionProps() instead

These are the ones with a prefix of "option."

Returns:
one big string of "key=val key=val ..."

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)
Deprecated. unused

A text description of the tunnel.


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)