java.lang.Object
net.i2p.router.dummy.DummyTunnelManagerFacade
- All Implemented Interfaces:
Service, TunnelManagerFacade
Build and maintain tunnels throughout the network.
Constructor Summary
ConstructorsMethod Summary
All MethodsModifier and TypeMethodDescriptionbooleanaddAlias(Destination dest, ClientTunnelSettings settings, Destination existingClient) Add another destination to the same tunnels.voidbuildTunnels(Destination client, ClientTunnelSettings settings) The client connected (or updated their settings), so make sure we have the tunnels for them, and whenever necessary, ask them to authorize leases.intensurePoolsFor(Hash client) Run both of a client's pools' ensure logic on demand instead of waiting for the next build-timer interval.voidFail every tunnel that depends on a peer we can no longer reach: outbound tunnels with it as first hop, inbound tunnels with it as last hop.voidforceTunnelFailure(TunnelInfo tunnel) Force a tunnel to fail immediately and trigger a replacement build.intHow many free inbound tunnels do we have available?The ghost peer manager for tracking peers with consistent tunnel build timeouts.intCount how many inbound tunnel requests we have received but not yet processed.For TunnelRenderer in router console.intHow many free inbound client tunnels do we have available?intgetInboundClientTunnelCount(Hash destination) How many inbound client tunnels in this pool?For TunnelRenderer in router console.getInboundPool(Hash client) Inbound tunnel pool for the given client, or null if none.The inbound settings for the exploratory pool.getInboundSettings(Hash client) The inbound settings for the given client.longWhen does the last tunnel we are participating in expire?For TunnelRenderer in router console.intHow many outbound client tunnels do we have available?intgetOutboundClientTunnelCount(Hash destination) How many outbound client tunnels in this pool?For TunnelRenderer in router console.getOutboundPool(Hash client) Outbound tunnel pool for the given client, or null if none.The outbound settings for the exploratory pool.getOutboundSettings(Hash client) The outbound settings for the given client.intHow many outbound tunnels do we have available?intHow many tunnels are we participating in?doubleThe share ratio of tunnel bandwidth allocated to the network.booleanisValidTunnel(Hash client, TunnelInfo tunnel) Is a tunnel a valid member of the pool?voidlistPools(List<TunnelPool> out) For TunnelRenderer in router console.voidremoveAlias(Destination dest) Remove another destination to the same tunnels.voidremoveTunnels(Destination client) Must be called AFTER deregistration by the client manager.voidrenderStatusHTML(Writer out) Render the status as HTML.voidreportSendFailure(TunnelInfo tunnel, int status) Report a data-phase send failure for a specific tunnel.voidrestart()Perform a soft restart.Pick a random inbound tunnel from any pool — client pools first, then exploratory.Pick a random outbound tunnel from any pool — client pools first, then exploratory.selectInboundExploratoryTunnel(Hash closestTo) Pick the inbound exploratory tunnel with the gateway closest to the given hash.selectInboundTunnel(Hash destination) Pick a random inbound tunnel from the given destination's pool.selectInboundTunnel(Hash destination, Hash closestTo) Pick the inbound tunnel with the gateway closest to the given hash from the given destination's pool.selectOutboundExploratoryTunnel(Hash closestTo) Pick the outbound exploratory tunnel with the endpoint closest to the given hash.Pick a random outbound exploratory tunnel.selectOutboundTunnel(Hash destination) Pick a random outbound tunnel from the given destination's pool.selectOutboundTunnel(Hash destination, Hash closestTo) Pick the outbound tunnel with the endpoint closest to the given hash from the given destination's pool.Peers that should not be allowed to be in another tunnel.voidsetInboundSettings(Hash client, TunnelPoolSettings settings) The inbound settings for the given client.voidsetInboundSettings(TunnelPoolSettings settings) The inbound settings for the exploratory pool.voidsetOutboundSettings(Hash client, TunnelPoolSettings settings) The outbound settings for the given client.voidsetOutboundSettings(TunnelPoolSettings settings) The outbound settings for the exploratory pool.voidshutdown()Instruct the service that the router is shutting down and that it should do whatever is necessary to go down gracefully.voidstartup()Instruct the service that it should start normal operation.Methods inherited from class Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface TunnelManagerFacade
selectInboundTunnelModifier and TypeMethodDescriptionPick a random inbound exploratory tunnel.
Constructor Details
DummyTunnelManagerFacade
public DummyTunnelManagerFacade()Creates a new DummyTunnelManagerFacade.
Method Details
selectInboundTunnel
Description copied from interface:TunnelManagerFacadePick a random inbound tunnel from the given destination's pool.- Specified by:
selectInboundTunnelin interfaceTunnelManagerFacade- Parameters:
destination- if null, returns inbound exploratory tunnel- Returns:
- null if none
selectOutboundTunnel
Description copied from interface:TunnelManagerFacadePick a random outbound exploratory tunnel.- Specified by:
selectOutboundTunnelin interfaceTunnelManagerFacade- Returns:
- null if none
selectOutboundTunnel
Description copied from interface:TunnelManagerFacadePick a random outbound tunnel from the given destination's pool.- Specified by:
selectOutboundTunnelin interfaceTunnelManagerFacade- Parameters:
destination- if null, returns outbound exploratory tunnel- Returns:
- null if none
selectInboundExploratoryTunnel
Description copied from interface:TunnelManagerFacadePick the inbound exploratory tunnel with the gateway closest to the given hash. By using this instead of the random selectTunnel(), we force some locality in OBEP-IBGW connections to minimize those connections network-wide.- Specified by:
selectInboundExploratoryTunnelin interfaceTunnelManagerFacade- Parameters:
closestTo- non-null- Returns:
- null if none
selectInboundTunnel
Description copied from interface:TunnelManagerFacadePick the inbound tunnel with the gateway closest to the given hash from the given destination's pool. By using this instead of the random selectTunnel(), we force some locality in OBEP-IBGW connections to minimize those connections network-wide.- Specified by:
selectInboundTunnelin interfaceTunnelManagerFacade- Parameters:
destination- if null, returns inbound exploratory tunnelclosestTo- non-null- Returns:
- null if none
selectOutboundExploratoryTunnel
Description copied from interface:TunnelManagerFacadePick the outbound exploratory tunnel with the endpoint closest to the given hash. By using this instead of the random selectTunnel(), we force some locality in OBEP-IBGW connections to minimize those connections network-wide.- Specified by:
selectOutboundExploratoryTunnelin interfaceTunnelManagerFacade- Parameters:
closestTo- non-null- Returns:
- null if none
selectOutboundTunnel
Description copied from interface:TunnelManagerFacadePick the outbound tunnel with the endpoint closest to the given hash from the given destination's pool. By using this instead of the random selectTunnel(), we force some locality in OBEP-IBGW connections to minimize those connections network-wide.- Specified by:
selectOutboundTunnelin interfaceTunnelManagerFacade- Parameters:
destination- if null, returns outbound exploratory tunnelclosestTo- non-null- Returns:
- null if none
selectAnyOutboundTunnel
Description copied from interface:TunnelManagerFacadePick a random outbound tunnel from any pool — client pools first, then exploratory.- Specified by:
selectAnyOutboundTunnelin interfaceTunnelManagerFacade- Returns:
- null if none
selectAnyInboundTunnel
Description copied from interface:TunnelManagerFacadePick a random inbound tunnel from any pool — client pools first, then exploratory.- Specified by:
selectAnyInboundTunnelin interfaceTunnelManagerFacade- Returns:
- null if none
isValidTunnel
Description copied from interface:TunnelManagerFacadeIs a tunnel a valid member of the pool?- Specified by:
isValidTunnelin interfaceTunnelManagerFacade- Parameters:
client- hash of the destination whose pool is checkedtunnel- candidate, rejected if failed or expired- Returns:
- true only if unfailed, unexpired and listed in that client's inbound or outbound pool, matching the tunnel's direction
getParticipatingCount
public int getParticipatingCount()Description copied from interface:TunnelManagerFacadeHow many tunnels are we participating in?- Specified by:
getParticipatingCountin interfaceTunnelManagerFacade- Returns:
- number of tunnels where we are a gateway or an endpoint
getFreeTunnelCount
public int getFreeTunnelCount()Description copied from interface:TunnelManagerFacadeHow many free inbound tunnels do we have available?- Specified by:
getFreeTunnelCountin interfaceTunnelManagerFacade- Returns:
- number of valid, unfailed inbound exploratory tunnels
getOutboundTunnelCount
public int getOutboundTunnelCount()Description copied from interface:TunnelManagerFacadeHow many outbound tunnels do we have available?- Specified by:
getOutboundTunnelCountin interfaceTunnelManagerFacade- Returns:
- number of valid, unfailed outbound exploratory tunnels
getInboundClientTunnelCount
public int getInboundClientTunnelCount()Description copied from interface:TunnelManagerFacadeHow many free inbound client tunnels do we have available?- Specified by:
getInboundClientTunnelCountin interfaceTunnelManagerFacade- Returns:
- total over all destinations of GOOD (tested and passed) inbound client tunnels
getOutboundClientTunnelCount
public int getOutboundClientTunnelCount()Description copied from interface:TunnelManagerFacadeHow many outbound client tunnels do we have available?- Specified by:
getOutboundClientTunnelCountin interfaceTunnelManagerFacade- Returns:
- total over all destinations of GOOD (tested and passed) outbound client tunnels
getOutboundClientTunnelCount
Description copied from interface:TunnelManagerFacadeHow many outbound client tunnels in this pool?- Specified by:
getOutboundClientTunnelCountin interfaceTunnelManagerFacade- Parameters:
destination- hash of the destination owning the outbound pool- Returns:
- GOOD tunnel count, or the count including untested tunnels while bootstrapping, or 0 if no pool is registered
getInboundClientTunnelCount
Description copied from interface:TunnelManagerFacadeHow many inbound client tunnels in this pool?- Specified by:
getInboundClientTunnelCountin interfaceTunnelManagerFacade- Parameters:
destination- hash of the destination owning the inbound pool- Returns:
- GOOD tunnel count, or the count including untested tunnels while bootstrapping, or 0 if no pool is registered
getLastParticipatingExpiration
public long getLastParticipatingExpiration()Description copied from interface:TunnelManagerFacadeWhen does the last tunnel we are participating in expire?- Specified by:
getLastParticipatingExpirationin interfaceTunnelManagerFacade- Returns:
- expiration of the latest-expiring participating tunnel in milliseconds since the epoch, or -1 if we participate in none
buildTunnels
Description copied from interface:TunnelManagerFacadeThe client connected (or updated their settings), so make sure we have the tunnels for them, and whenever necessary, ask them to authorize leases.- Specified by:
buildTunnelsin interfaceTunnelManagerFacade- Parameters:
client- connecting destination, whose hash keys the pools created heresettings- per-destination inbound and outbound pool settings, which replace those of any pools that already exist
removeTunnels
Description copied from interface:TunnelManagerFacadeMust be called AFTER deregistration by the client manager.- Specified by:
removeTunnelsin interfaceTunnelManagerFacade- Parameters:
client- destination whose pools are scheduled for removal, deferred so its tunnels keep operating until they expire
addAlias
public boolean addAlias(Destination dest, ClientTunnelSettings settings, Destination existingClient) Description copied from interface:TunnelManagerFacadeAdd another destination to the same tunnels. Must have same encryption key and a different signing key.- Specified by:
addAliasin interfaceTunnelManagerFacade- Parameters:
dest- alias destination, which gets its own pools flagged as aliasedsettings- settings for the alias pools, retained under the primary hashexistingClient- primary destination whose tunnels are being shared- Returns:
- true if the alias pools were created, false if the destination already had pools or the primary has none
removeAlias
Description copied from interface:TunnelManagerFacadeRemove another destination to the same tunnels.- Specified by:
removeAliasin interfaceTunnelManagerFacade- Parameters:
dest- alias destination to drop from the primary's alias set
getInboundSettings
Description copied from interface:TunnelManagerFacadeThe inbound settings for the exploratory pool.- Specified by:
getInboundSettingsin interfaceTunnelManagerFacade- Returns:
- the inbound settings
getOutboundSettings
Description copied from interface:TunnelManagerFacadeThe outbound settings for the exploratory pool.- Specified by:
getOutboundSettingsin interfaceTunnelManagerFacade- Returns:
- the outbound settings
getInboundSettings
Description copied from interface:TunnelManagerFacadeThe inbound settings for the given client.- Specified by:
getInboundSettingsin interfaceTunnelManagerFacade- Parameters:
client- the client hash- Returns:
- the inbound settings
getOutboundSettings
Description copied from interface:TunnelManagerFacadeThe outbound settings for the given client.- Specified by:
getOutboundSettingsin interfaceTunnelManagerFacade- Parameters:
client- the client hash- Returns:
- the outbound settings
setInboundSettings
Description copied from interface:TunnelManagerFacadeThe inbound settings for the exploratory pool.- Specified by:
setInboundSettingsin interfaceTunnelManagerFacade- Parameters:
settings- the inbound settings
setOutboundSettings
Description copied from interface:TunnelManagerFacadeThe outbound settings for the exploratory pool.- Specified by:
setOutboundSettingsin interfaceTunnelManagerFacade- Parameters:
settings- the outbound settings
setInboundSettings
Description copied from interface:TunnelManagerFacadeThe inbound settings for the given client.- Specified by:
setInboundSettingsin interfaceTunnelManagerFacade- Parameters:
client- the client hashsettings- the inbound settings
setOutboundSettings
Description copied from interface:TunnelManagerFacadeThe outbound settings for the given client.- Specified by:
setOutboundSettingsin interfaceTunnelManagerFacade- Parameters:
client- the client hashsettings- the outbound settings
getInboundBuildQueueSize
public int getInboundBuildQueueSize()Description copied from interface:TunnelManagerFacadeCount how many inbound tunnel requests we have received but not yet processed.- Specified by:
getInboundBuildQueueSizein interfaceTunnelManagerFacade- Returns:
- number of inbound build requests waiting in the queue
selectPeersInTooManyTunnels
Description copied from interface:TunnelManagerFacadePeers that should not be allowed to be in another tunnel.- Specified by:
selectPeersInTooManyTunnelsin interfaceTunnelManagerFacade- Returns:
- Set of peers that should not be allowed to be in another tunnel
renderStatusHTML
Description copied from interface:ServiceRender the status as HTML.- Specified by:
renderStatusHTMLin interfaceService- Parameters:
out- the writer to write to- Throws:
IOException- if an error occurs writing
restart
shutdown
public void shutdown()Description copied from interface:ServiceInstruct the service that the router is shutting down and that it should do whatever is necessary to go down gracefully. It should not depend on other components at this point. This call DOES block.startup
listPools
Description copied from interface:TunnelManagerFacadeFor TunnelRenderer in router console.- Specified by:
listPoolsin interfaceTunnelManagerFacade- Parameters:
out- list that the client inbound, client outbound and both exploratory pools are appended to
getInboundClientPools
Description copied from interface:TunnelManagerFacadeFor TunnelRenderer in router console.- Specified by:
getInboundClientPoolsin interfaceTunnelManagerFacade- Returns:
- snapshot of the inbound pools, keyed by destination hash
getOutboundClientPools
Description copied from interface:TunnelManagerFacadeFor TunnelRenderer in router console.- Specified by:
getOutboundClientPoolsin interfaceTunnelManagerFacade- Returns:
- snapshot of the outbound pools, keyed by destination hash
getInboundExploratoryPool
Description copied from interface:TunnelManagerFacadeFor TunnelRenderer in router console.- Specified by:
getInboundExploratoryPoolin interfaceTunnelManagerFacade- Returns:
- the shared inbound exploratory pool, never null
getOutboundExploratoryPool
Description copied from interface:TunnelManagerFacadeFor TunnelRenderer in router console.- Specified by:
getOutboundExploratoryPoolin interfaceTunnelManagerFacade- Returns:
- the shared outbound exploratory pool, never null
fail
Description copied from interface:TunnelManagerFacadeFail every tunnel that depends on a peer we can no longer reach: outbound tunnels with it as first hop, inbound tunnels with it as last hop.- Specified by:
failin interfaceTunnelManagerFacade- Parameters:
peer- hash of the unreachable peer
getInboundPool
Description copied from interface:TunnelManagerFacadeInbound tunnel pool for the given client, or null if none.- Specified by:
getInboundPoolin interfaceTunnelManagerFacade- Parameters:
client- hash of the destination that owns the pool- Returns:
- pool or null
getOutboundPool
Description copied from interface:TunnelManagerFacadeOutbound tunnel pool for the given client, or null if none.- Specified by:
getOutboundPoolin interfaceTunnelManagerFacade- Parameters:
client- hash of the destination that owns the pool- Returns:
- pool or null
getGhostPeerManager
Description copied from interface:TunnelManagerFacadeThe ghost peer manager for tracking peers with consistent tunnel build timeouts.- Specified by:
getGhostPeerManagerin interfaceTunnelManagerFacade- Returns:
- the GhostPeerManager instance
reportSendFailure
Description copied from interface:TunnelManagerFacadeReport a data-phase send failure for a specific tunnel. Called from the I2CP message dispatch path when a message fails through a known tunnel (e.g. expired, local overflow, no tunnels available). Increments the tunnel's failure counter and triggers replacement builds when the threshold is reached, so the pool rotates away from the failing tunnel faster than TestJob alone.- Specified by:
reportSendFailurein interfaceTunnelManagerFacade- Parameters:
tunnel- the outbound tunnel that carried the failed messagestatus- the I2CP MessageStatusMessage failure code
ensurePoolsFor
Description copied from interface:TunnelManagerFacadeRun both of a client's pools' ensure logic on demand instead of waiting for the next build-timer interval. Called from the data phase when a send failed for pool-empty reasons (message expired while queued, no tunnels available). A liveness signal that the pools need rebuilding now. Each pool's internal ensure throttle still applies, so a failure storm cannot become a build storm.The pool maps are keyed by the local client (source) destination hash, never the remote destination: passing a remote hash finds no pools and silently does nothing.
Additive ABI: this method and its
intreturn both postdate 0.9.70+ (no release ever shipped avoidvariant), so implementations and callers only ever saw this signature; callers may still ignore the returned count.- Specified by:
ensurePoolsForin interfaceTunnelManagerFacade- Parameters:
client- the LOCAL client destination hash whose pools should rebuild- Returns:
- how many pools were nudged; 0 when none are registered for the client
forceTunnelFailure
Description copied from interface:TunnelManagerFacadeForce a tunnel to fail immediately and trigger a replacement build. Used when rotation is saturated and the pool has no viable alternative tunnels (e.g., all tunnels in the pool match the cached tunnel). This bypasses the incremental failure counter and directly removes the tunnel, ensuring the pool builds a replacement without waiting for multiple failure reports.- Specified by:
forceTunnelFailurein interfaceTunnelManagerFacade- Parameters:
tunnel- the outbound tunnel to force-fail