Usage:
MultiRouter numberRouters
Each routerContext specified is used to boot up a single router. It is HIGHLY recommended that those context files contain a few base env properties:
- loggerFilenameOverride=rN/logs/log-router-#.txt
router.configLocation=rN/router.config
Optionally, i2p.vmCommSystem=true can be enabled.
i2p.vmCommSystem=true tells the router to use an in-VM comm system for sending messages back and forth between routers (see net.i2p.transport.VMCommSystem).
However, the default comm system implementation is usually preferred since enabling the VMCommSystem will bypass UDP and TCP, and therefore will not provide a test bed for many important I2P systems.
To make the router console work, either run from a directory containing lib/, webapps/, docs/, etc., or point i2p.dir.base to a directory containing the above.
The multirouter waits until all of the routers are shut down (which none will do on their own, so as before, you'll want to kill the proc or ^C it).
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static I2PAppContextThe default context shared by the test routers.private static final intFirst port given to the test routers.private static intNumber of test routers to run.private static PrintStreamStream for the test output.The test routers running.Constructor Summary
ConstructorsConstructorDescriptionThe router list, the default context and the output stream are all static and are set bymain(String[]), so an instance carries no state.Method Summary
Modifier and TypeMethodDescriptionprivate static PropertiesbuildClientProps(int id) Writes the client config file for one test router.private static PropertiesbuildRouterProps(int id) Writes the router config file for one test router.private static StringgetBaseDir(int id) The data directory for one test router.private static PropertiesReads the client config file.private static PropertiesgetRouterProps(int id) Reads the router config file for one test router.private static voidReseeds the test routers in the background.static voidBoot the requested number of routers from the given arguments.private static voidusage()Prints the command line usage.private static voidWaits for all the test routers to exit.
Field Details
BASE_PORT
private static final int BASE_PORTFirst port given to the test routers.- See Also:
nbrRouters
private static int nbrRoutersNumber of test routers to run.out
Stream for the test output.routers
_defaultContext
The default context shared by the test routers.
Constructor Details
MultiRouter
public MultiRouter()The router list, the default context and the output stream are all static and are set bymain(String[]), so an instance carries no state.
Method Details
main
Boot the requested number of routers from the given arguments.- Parameters:
args- the command line, whose first element is the number of routers to boot; usage is printed when it is absent or not a positive integer
internalReseed
private static void internalReseed()Reseeds the test routers in the background.buildRouterProps
Writes the router config file for one test router.- Parameters:
id- the router number- Returns:
- the properties written
getRouterProps
Reads the router config file for one test router.- Parameters:
id- the router number- Returns:
- the properties read
buildClientProps
Writes the client config file for one test router.- Parameters:
id- the router number- Returns:
- the properties written
getClientProps
getBaseDir
The data directory for one test router.- Parameters:
id- the router number- Returns:
- the directory path
waitForCompletion
private static void waitForCompletion()Waits for all the test routers to exit.usage
private static void usage()Prints the command line usage.