## net.i2p.router
Class Router

    java.lang.Object
      net.i2p.router.Router

public class Router
extends java.lang.Object

Main driver for the router.

Field Summary
`static char` `CAPABILITY_NEW_TUNNEL`
`static char` `CAPABILITY_REACHABLE`
`static char` `CAPABILITY_UNREACHABLE`
`static long` `CLOCK_FUDGE_FACTOR` let clocks be off by 1 minute
`static int` `EXIT_GRACEFUL`
`static int` `EXIT_GRACEFUL_RESTART`
`static int` `EXIT_HARD`
`static int` `EXIT_HARD_RESTART`
`static int` `EXIT_OOM`
`(package private) static long` `LIVELINESS_DELAY`
`static int` `NETWORK_ID` used to differentiate routerInfo files on different networks
`static java.lang.String` `PROP_CONFIG_FILE`
`static java.lang.String` `PROP_DYNAMIC_KEYS`
`static java.lang.String` `PROP_FORCE_UNREACHABLE`
`static java.lang.String` `PROP_HIDDEN`
`static java.lang.String` `PROP_INFO_FILENAME`
`static java.lang.String` `PROP_INFO_FILENAME_DEFAULT`
`static java.lang.String` `PROP_KEYS_FILENAME`
`static java.lang.String` `PROP_KEYS_FILENAME_DEFAULT`
`static java.lang.String` `PROP_SHUTDOWN_IN_PROGRESS`

Constructor Summary
`Router()`
`Router(java.util.Properties envProps)`
`Router(java.lang.String configFilename)`
`Router(java.lang.String configFilename, java.util.Properties envProps)`

Method Summary
`void` `addReachabilityCapability(RouterInfo ri)`
`void` `addShutdownTask(java.lang.Runnable task)`
`void` `cancelGracefulShutdown()` Cancel any prior request to shut the router down gracefully.
`Certificate` `createCertificate()`
`void` `finalShutdown(int exitCode)`
`java.lang.String` `getConfigFilename()`
`java.util.Properties` `getConfigMap()`
`java.lang.String` `getConfigSetting(java.lang.String name)`
`java.util.Set` `getConfigSettings()`
`RouterContext` `getContext()`
`boolean` `getHigherVersionSeen()` True if the router has tried to communicate with another router who is running a higher incompatible protocol version.
`boolean` `getKillVMOnEnd()`
`RouterInfo` `getRouterInfo()`
`long` `getShutdownTimeRemaining()` How long until the graceful shutdown will kill us?
`long` `getUptime()` wall clock uptime
`long` `getWhenStarted()`
`boolean` `gracefulShutdownInProgress()`
`boolean` `isAlive()`
`boolean` `isHidden()`
`static void` `killKeys()`
`static void` `main(java.lang.String[] args)`
`void` `readConfig()`
`void` `rebuildNewIdentity()` Rebuild a new identity the hard way - delete all of our old identity files, then reboot the router.
`void` `rebuildRouterInfo()` Rebuild and republish our routerInfo since something significant has changed.
`void` `rebuildRouterInfo(boolean blockingRebuild)`
`void` `removeConfigSetting(java.lang.String name)`
`void` `renderStatusHTML(java.io.Writer out)`
`void` `restart()`
`(package private) void` `runRouter()`
`boolean` `saveConfig()` Save the current config options (returning true if save was successful, false otherwise)
`int` `scheduledGracefulExitCode()` What exit code do we plan on using when we shut down (or -1, if there isn't a graceful shutdown planned)
`void` `setConfigFilename(java.lang.String filename)`
`void` `setConfigSetting(java.lang.String name, java.lang.String value)`
`void` `setHigherVersionSeen(boolean seen)`
`void` `setKillVMOnEnd(boolean shouldDie)` Configure the router to kill the JVM when the router shuts down, as well as whether to explicitly halt the JVM during the hard fail process.
`void` `setRouterInfo(RouterInfo info)`
`void` `shutdown(int exitCode)`
`void` `shutdownGracefully()` Call this if we want the router to kill itself as soon as we aren't participating in any more tunnels (etc).
`void` `shutdownGracefully(int exitCode)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### PROP_CONFIG_FILE

    public static final java.lang.String PROP_CONFIG_FILE

See Also:
  Constant Field Values

### CLOCK_FUDGE_FACTOR

    public static final long CLOCK_FUDGE_FACTOR

  let clocks be off by 1 minute

  See Also:
    Constant Field Values

### NETWORK_ID

    public static final int NETWORK_ID

  used to differentiate routerInfo files on different networks

  See Also:
    Constant Field Values

### PROP_HIDDEN

    public static final java.lang.String PROP_HIDDEN

See Also:
  Constant Field Values

### PROP_DYNAMIC_KEYS

    public static final java.lang.String PROP_DYNAMIC_KEYS

See Also:
  Constant Field Values

### PROP_INFO_FILENAME

    public static final java.lang.String PROP_INFO_FILENAME

See Also:
  Constant Field Values

### PROP_INFO_FILENAME_DEFAULT

    public static final java.lang.String PROP_INFO_FILENAME_DEFAULT

See Also:
  Constant Field Values

### PROP_KEYS_FILENAME

    public static final java.lang.String PROP_KEYS_FILENAME

See Also:
  Constant Field Values

### PROP_KEYS_FILENAME_DEFAULT

    public static final java.lang.String PROP_KEYS_FILENAME_DEFAULT

See Also:
  Constant Field Values

### PROP_SHUTDOWN_IN_PROGRESS

    public static final java.lang.String PROP_SHUTDOWN_IN_PROGRESS

See Also:
  Constant Field Values

### CAPABILITY_REACHABLE

    public static final char CAPABILITY_REACHABLE

See Also:
  Constant Field Values

### CAPABILITY_UNREACHABLE

    public static final char CAPABILITY_UNREACHABLE

See Also:
  Constant Field Values

### PROP_FORCE_UNREACHABLE

    public static final java.lang.String PROP_FORCE_UNREACHABLE

See Also:
  Constant Field Values

### CAPABILITY_NEW_TUNNEL

    public static final char CAPABILITY_NEW_TUNNEL

See Also:
  Constant Field Values

### EXIT_GRACEFUL

    public static final int EXIT_GRACEFUL

See Also:
  Constant Field Values

### EXIT_HARD

    public static final int EXIT_HARD

See Also:
  Constant Field Values

### EXIT_OOM

    public static final int EXIT_OOM

See Also:
  Constant Field Values

### EXIT_HARD_RESTART

    public static final int EXIT_HARD_RESTART

See Also:
  Constant Field Values

### EXIT_GRACEFUL_RESTART

    public static final int EXIT_GRACEFUL_RESTART

See Also:
  Constant Field Values

### LIVELINESS_DELAY

    static final long LIVELINESS_DELAY

See Also:
  Constant Field Values

Constructor Detail

### Router

    public Router()

### Router

    public Router(java.util.Properties envProps)

### Router

    public Router(java.lang.String configFilename)

### Router

    public Router(java.lang.String configFilename,
                  java.util.Properties envProps)

Method Detail

### setKillVMOnEnd

    public void setKillVMOnEnd(boolean shouldDie)

  Configure the router to kill the JVM when the router shuts down, as well as whether to explicitly halt the JVM during the hard fail process.

### getKillVMOnEnd

    public boolean getKillVMOnEnd()

### getConfigFilename

    public java.lang.String getConfigFilename()

### setConfigFilename

    public void setConfigFilename(java.lang.String filename)

### getConfigSetting

    public java.lang.String getConfigSetting(java.lang.String name)

### setConfigSetting

    public void setConfigSetting(java.lang.String name,
                                 java.lang.String value)

### removeConfigSetting

    public void removeConfigSetting(java.lang.String name)

### getConfigSettings

    public java.util.Set getConfigSettings()

### getConfigMap

    public java.util.Properties getConfigMap()

### getRouterInfo

    public RouterInfo getRouterInfo()

### setRouterInfo

    public void setRouterInfo(RouterInfo info)

### getHigherVersionSeen

    public boolean getHigherVersionSeen()

  True if the router has tried to communicate with another router who is running a higher incompatible protocol version.

### setHigherVersionSeen

    public void setHigherVersionSeen(boolean seen)

### getWhenStarted

    public long getWhenStarted()

### getUptime

    public long getUptime()

  wall clock uptime

### getContext

    public RouterContext getContext()

### runRouter

    void runRouter()

### readConfig

    public void readConfig()

### isAlive

    public boolean isAlive()

### rebuildRouterInfo

    public void rebuildRouterInfo()

  Rebuild and republish our routerInfo since something significant has changed.

### rebuildRouterInfo

    public void rebuildRouterInfo(boolean blockingRebuild)

### addReachabilityCapability

    public void addReachabilityCapability(RouterInfo ri)

### isHidden

    public boolean isHidden()

### createCertificate

    public Certificate createCertificate()

### killKeys

    public static void killKeys()

### rebuildNewIdentity

    public void rebuildNewIdentity()

  Rebuild a new identity the hard way - delete all of our old identity files, then reboot the router.

### renderStatusHTML

    public void renderStatusHTML(java.io.Writer out)
                          throws java.io.IOException

  Throws:
    `java.io.IOException`

### addShutdownTask

    public void addShutdownTask(java.lang.Runnable task)

### shutdown

    public void shutdown(int exitCode)

### finalShutdown

    public void finalShutdown(int exitCode)

### shutdownGracefully

    public void shutdownGracefully()

  Call this if we want the router to kill itself as soon as we aren't participating in any more tunnels (etc). This will not block and doesn't guarantee any particular time frame for shutting down. To shut the router down immediately, use `shutdown(int)`. If you want to cancel the graceful shutdown (prior to actual shutdown ;), call `cancelGracefulShutdown()`.

### shutdownGracefully

    public void shutdownGracefully(int exitCode)

### cancelGracefulShutdown

    public void cancelGracefulShutdown()

  Cancel any prior request to shut the router down gracefully.

### scheduledGracefulExitCode

    public int scheduledGracefulExitCode()

  What exit code do we plan on using when we shut down (or -1, if there isn't a graceful shutdown planned)

### gracefulShutdownInProgress

    public boolean gracefulShutdownInProgress()

### getShutdownTimeRemaining

    public long getShutdownTimeRemaining()

  How long until the graceful shutdown will kill us?

### saveConfig

    public boolean saveConfig()

  Save the current config options (returning true if save was successful, false otherwise)

### restart

    public void restart()

### main

    public static void main(java.lang.String[] args)