public class RouterContext extends I2PAppContext
_clock, _clockInitialized, _globalAppContext, _keyRing, _keyRingInitialized, _overrideProps, _sessionKeyManager, _sessionKeyManagerInitialized, _shutdownTasks| Constructor and Description |
|---|
RouterContext(Router router)
Caller MUST call initAll() after instantiation.
|
RouterContext(Router router,
Properties envProps)
Caller MUST call initAll() after instantiation.
|
RouterContext(Router router,
Properties envProps,
boolean doInit)
Caller MUST call initAll() after instantiation.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addFinalShutdownTask(Runnable task)
Add a task to be run during final shutdown.
|
void |
addPropertyCallback(I2PProperties.I2PPropertyCallback callback)
Add a callback for property changes.
|
FIFOBandwidthLimiter |
bandwidthLimiter()
Coordinate this router's bandwidth limits
|
Banlist |
banlist()
Get thebanlist for managing banned peers.
|
Blocklist |
blocklist()
Get the blocklist for managing blocked peers.
|
ClientAppManager |
clientAppManager()
The RouterAppManager.
|
ClientManagerFacade |
clientManager()
How are we coordinating clients for the router?
|
ClientMessagePool |
clientMessagePool()
Where do we toss messages for the clients (and where do we get client messages
to forward on from)?
|
NetworkDatabaseFacade |
clientNetDb(Hash id)
Get the client netDb for the given id.
|
CommSystemFacade |
commSystem()
How do we pass messages from our outNetMessagePool to another router
|
ECIESAEADEngine |
eciesEngine()
Access the ECIES/AEAD engine for this context.
|
ElGamalAESEngine |
elGamalAESEngine()
Access the ElGamal/AES+SessionTag engine for this context.
|
GarlicMessageParser |
garlicMessageParser()
Get the garlic message parser for this context.
|
(package private) static List<RouterContext> |
getContexts()
Same as listContexts() but package private and modifiable.
|
long |
getEstimatedDowntime()
How long this router was down before it started, or 0 if unknown.
|
(package private) Set<Runnable> |
getFinalShutdownTasks()
Get the set of final shutdown tasks.
|
Properties |
getProperties()
Access the configuration attributes of this context, listing the properties
provided during the context construction, as well as the ones included in
System.getProperties.
|
String |
getProperty(String propName)
Tie in the router's config as properties, as well as whatever the
I2PAppContext says.
|
int |
getProperty(String propName,
int defaultVal)
Return an int with an int default
|
long |
getProperty(String propName,
long defaultVal)
Return a long with a long default
|
String |
getProperty(String propName,
String defaultVal)
Tie in the router's config as properties, as well as whatever the
I2PAppContext says.
|
void |
initAll()
The following properties may be used to replace various parts
of the context with dummy implementations for testing, by setting
the property to "true":
|
protected void |
initializeClock() |
protected void |
initializeKeyRing() |
protected void |
initializeSessionKeyManager()
As of 0.9.15, this returns a dummy SessionKeyManager in I2PAppContext.
|
InNetMessagePool |
inNetMessagePool()
Where do we get network messages from (aka where does the comm system dump what
it reads)?
|
InternalClientManager |
internalClientManager()
Use this to connect to the router in the same JVM.
|
boolean |
isRouterContext()
Use this instead of context instanceof RouterContext
|
JobQueue |
jobQueue()
The actual driver of the router, where all jobs are enqueued and processed.
|
KeyManager |
keyManager()
Coordinates the router's ElGamal and DSA keys, as well as any keys given
to it by clients as part of a LeaseSet.
|
KeyRing |
keyRing()
override to support storage in router.config
|
(package private) static void |
killGlobalContext()
Kill the global I2PAppContext, so it isn't still around
when we restart in the same JVM (Android).
|
static List<RouterContext> |
listContexts()
Retrieve the list of router contexts currently instantiated in this JVM.
|
MessageHistory |
messageHistory()
Tracker component for monitoring what messages are wrapped in what containers
and how they proceed through the network.
|
OutboundMessageRegistry |
messageRegistry()
The registry is used by outbound messages to wait for replies.
|
MessageValidator |
messageValidator()
The router keeps track of messages it receives to prevent duplicates, as
well as other criteria for "validity".
|
NetworkDatabaseFacade |
netDb()
Get the main network database facade for standard database operations.
|
SegmentedNetworkDatabaseFacade |
netDbSegmentor()
Get the network database segmentor for advanced database access.
|
OutNetMessagePool |
outNetMessagePool()
Where do we put messages that the router wants to forwards onto the network?
|
PeerManagerFacade |
peerManager()
Minimal interface for selecting peers for various tasks based on given
criteria.
|
ProfileManager |
profileManager()
Expose a simple API for various router components to take note of
particular events that a peer enacts (sends us a message, agrees to
participate in a tunnel, etc).
|
ProfileOrganizer |
profileOrganizer()
Organize the peers we know about into various tiers, profiling their
performance and sorting them accordingly.
|
(package private) void |
removeProperty(String propName)
Remove a property provided during the context construction.
|
(package private) void |
removeShutdownTasks()
Remove all shutdown tasks from the context.
|
Router |
router()
what router is this context working for?
|
RouterAppManager |
routerAppManager()
The RouterAppManager.
|
Hash |
routerHash()
Convenience method for getting the router hash.
|
RouterKeyGenerator |
routerKeyGenerator()
Get the routing key generator for this context.
|
RoutingKeyGenerator |
routingKeyGenerator()
Determine how much do we want to mess with the keys to turn them
into something we can route.
|
(package private) static boolean |
setGlobalContext(RouterContext ctx)
Sets the default context, unless there is one already.
|
StatisticsManager |
statPublisher()
If the router is configured to, gather up some particularly tasty morsels
regarding the stats managed and offer to publish them into the routerInfo.
|
RouterThrottle |
throttle()
Get the router throttle controller for managing load.
|
String |
toString() |
TunnelDispatcher |
tunnelDispatcher()
Handle tunnel messages, as well as coordinate the gateways
|
TunnelManagerFacade |
tunnelManager()
Coordinate this router's tunnels (its pools, participation, backup, etc).
|
addShutdownTask, aes, clock, deleteTempDir, dsa, elGamalEngine, getAppDir, getBaseDir, getBooleanProperty, getBooleanPropertyDefaultTrue, getConfigDir, getCurrentContext, getGlobalContext, getLibDir, getLogDir, getPIDDir, getProperty, getProperty, getPropertyNames, getRouterDir, getShutdownTasks, getTempDir, hasWrapper, hmac256, keyGenerator, logManager, namingService, portMapper, random, removeShutdownTask, sessionKeyManager, setGlobalContext, setLogManager, sha, simpleTimer2, statManagerpublic RouterContext(Router router)
router - may be null for unit tests if you are carefulpublic RouterContext(Router router, Properties envProps)
router - may be null for unit tests if you are carefulRouterContext(Router router, Properties envProps, boolean doInit)
router - may be null for unit tests if you are carefuldoInit - should this context be used as the global one (if necessary)?
Will only apply if there is no global context now.
If false, caller should call setGlobalContext() afterwards.public void addFinalShutdownTask(Runnable task)
task - the Runnable to execute during final shutdownpublic void addPropertyCallback(I2PProperties.I2PPropertyCallback callback)
addPropertyCallback in class I2PAppContextcallback - the callback to be notified of property changespublic FIFOBandwidthLimiter bandwidthLimiter()
public Banlist banlist()
public Blocklist blocklist()
public ClientAppManager clientAppManager()
clientAppManager in class I2PAppContextpublic ClientManagerFacade clientManager()
public ClientMessagePool clientMessagePool()
public NetworkDatabaseFacade clientNetDb(Hash id)
id - may be nullpublic CommSystemFacade commSystem()
public ECIESAEADEngine eciesEngine()
public ElGamalAESEngine elGamalAESEngine()
public GarlicMessageParser garlicMessageParser()
static List<RouterContext> getContexts()
public long getEstimatedDowntime()
getEstimatedDowntime in class I2PAppContextSet<Runnable> getFinalShutdownTasks()
public Properties getProperties()
I2PAppContextgetProperties in class I2PAppContextpublic String getProperty(String propName)
getProperty in class I2PAppContextpublic int getProperty(String propName, int defaultVal)
getProperty in class I2PAppContextpublic long getProperty(String propName, long defaultVal)
getProperty in class I2PAppContextpublic String getProperty(String propName, String defaultVal)
getProperty in class I2PAppContextpublic void initAll()
i2p.dummyClientFacade i2p.dummyNetDb i2p.dummyPeerManager i2p.dummyTunnelManager i2p.vmCommSystem (transport)
protected void initializeClock()
initializeClock in class I2PAppContextprotected void initializeKeyRing()
initializeKeyRing in class I2PAppContextprotected void initializeSessionKeyManager()
initializeSessionKeyManager in class I2PAppContextpublic InNetMessagePool inNetMessagePool()
public InternalClientManager internalClientManager()
internalClientManager in class I2PAppContextpublic boolean isRouterContext()
isRouterContext in class I2PAppContextpublic JobQueue jobQueue()
public KeyManager keyManager()
public KeyRing keyRing()
keyRing in class I2PAppContextstatic void killGlobalContext()
public static List<RouterContext> listContexts()
public MessageHistory messageHistory()
public OutboundMessageRegistry messageRegistry()
public MessageValidator messageValidator()
public NetworkDatabaseFacade netDb()
public SegmentedNetworkDatabaseFacade netDbSegmentor()
public OutNetMessagePool outNetMessagePool()
public PeerManagerFacade peerManager()
public ProfileManager profileManager()
public ProfileOrganizer profileOrganizer()
void removeProperty(String propName)
propName - The name of the property.void removeShutdownTasks()
public Router router()
public RouterAppManager routerAppManager()
public Hash routerHash()
public RouterKeyGenerator routerKeyGenerator()
public RoutingKeyGenerator routingKeyGenerator()
routingKeyGenerator in class I2PAppContextstatic boolean setGlobalContext(RouterContext ctx)
ctx - context constructed with doInit = falsepublic StatisticsManager statPublisher()
public RouterThrottle throttle()
public TunnelDispatcher tunnelDispatcher()
public TunnelManagerFacade tunnelManager()