Package i2p :: Module router
[show private | hide private]
[frames | no frames]

Module i2p.router

Router control module
Function Summary
  check(dir)
Checks whether a locally installed router is running.
  find(dir)
Find the absolute path to a locally installed I2P router.
  start(dir, hidden)
Start a locally installed I2P router.
  stop(dir, force)
Stop a locally installed I2P router, if it was started by the current Python program.
  _parse_config(filename)
Return a dict with (name, value) items for the given I2P configuration file.
  _run_program(filename)
Runs the given program in a new process and new terminal.

Variable Summary
list check_addrlist = ['127.0.0.1:7656', '127.0.0.1:4444']
bool our_router = False
lock our_router_lock = <thread.lock object at 0x0089D120>

Function Details

check(dir=None)

Checks whether a locally installed router is running. Does nothing if successful, otherwise raises i2p.RouterError.

An I2P installation is located by using find(dir). The router.config file is parsed for 'router.adminPort'. This port is queried to determine whether the router is running.

find(dir=None)

Find the absolute path to a locally installed I2P router.

An I2P installation is located by looking in the environment I2P, then in PATH, then in the dir argument given to the function. It looks for startRouter.sh or startRouter.bat. Raises ValueError if an I2P installation could not be located.

start(dir=None, hidden=False)

Start a locally installed I2P router. Does nothing if the router has already been started.

An I2P installation is located by using find(dir).

If hidden is True, do not show a terminal for the router.

stop(dir=None, force=False)

Stop a locally installed I2P router, if it was started by the current Python program. If force is True, stop the router even if it was started by another process. Do nothing if force is False and the router was started by another program.

The file 'router.config' is located using the same search process used for find(dir). It is parsed for 'router.shutdownPassword' and 'router.adminPort'. The router is shut down through the admin port.

Raises i2p.RouterError if the I2P router is running but cannot be stopped. You must uncomment the 'router.shutdownPassword' line for this command to work.

_parse_config(filename)

Return a dict with (name, value) items for the given I2P configuration file.

_run_program(filename)

Runs the given program in a new process and new terminal.

Variable Details

check_addrlist

Type:
list
Value:
['127.0.0.1:7656', '127.0.0.1:4444']                                   

our_router

Type:
bool
Value:
False                                                                  

our_router_lock

Type:
lock
Value:
<thread.lock object at 0x0089D120>                                     

Generated by Epydoc 2.1 on Mon Aug 02 01:07:41 2004 http://epydoc.sf.net