java.lang.Object
net.i2p.router.tunnel.TunnelGateway
net.i2p.router.tunnel.TunnelGatewayZeroHop
Serve as the gatekeeper for a tunnel with no hops, either inbound or outbound.
Nested Class Summary
Nested classes/interfaces inherited from class TunnelGateway
TunnelGateway.DelayedFlush, TunnelGateway.QueuePreprocessor, TunnelGateway.Receiver, TunnelGateway.SenderModifier and TypeClassDescriptionprotected classDelayed flush timer event.static interfaceInterface for preprocessing queued tunnel messages.static interfaceInterface for receiving encrypted tunnel data.static interfaceInterface for sending preprocessed tunnel data.Field Summary
FieldsModifier and TypeFieldDescriptionprivate final TunnelCreatorConfigThe tunnel this hop is the gateway of.private InboundMessageDistributorReads messages back from the next hop.private OutboundMessageDistributorSends messages to the next hop.Fields inherited from class TunnelGateway
_context, _delayedFlush, _lastFlush, _log, _messagesSent, _preprocessor, _queue, _receiver, _senderModifier and TypeFieldDescriptionprotected final RouterContextThe router context.protected final TunnelGateway.DelayedFlushThe delayed flush timer.protected longThe last flush time.protected final LogThe log instance.protected intThe messages sent count.protected final TunnelGateway.QueuePreprocessorThe queue preprocessor.protected final List<PendingGatewayMessage> The message queue.protected final TunnelGateway.ReceiverThe message receiver, consuming encrypted messages for forwarding.protected final TunnelGateway.SenderThe message sender, encrypting and forwarding preprocessed messages.Constructor Summary
ConstructorsConstructorDescriptionTunnelGatewayZeroHop(RouterContext context, TunnelCreatorConfig config) Create a zero-hop gateway for the specified tunnel.Method Summary
All MethodsModifier and TypeMethodDescriptionbooleanadd(I2NPMessage msg, Hash toRouter, TunnelId toTunnel) Add a message to be sent down the tunnel (immediately forwarding it to theInboundMessageDistributororOutboundMessageDistributor, as necessary).booleanadd(TunnelGatewayMessage msg) Add a message to be sent down the tunnel, where we are the inbound gateway.Methods inherited from class TunnelGateway
getMessagesSent
Field Details
_config
The tunnel this hop is the gateway of._outDistributor
Sends messages to the next hop._inDistributor
Reads messages back from the next hop.
Constructor Details
TunnelGatewayZeroHop
Create a zero-hop gateway for the specified tunnel.- Parameters:
context- the router context passed to the superclass and to the message distributorconfig- the tunnel's configuration, which determines the direction and destination
Method Details
add
Add a message to be sent down the tunnel, where we are the inbound gateway. This requires converting the message included in the TGM from an UnknownI2NPMessage to the correct message class. See TunnelGatewayMessage for details.- Overrides:
addin classTunnelGateway- Parameters:
msg- message received to be sent through the tunnel- Returns:
- true if the message was accepted, false on conversion failure
add
Add a message to be sent down the tunnel (immediately forwarding it to theInboundMessageDistributororOutboundMessageDistributor, as necessary).- Overrides:
addin classTunnelGateway- Parameters:
msg- message to be sent through the tunneltoRouter- router to send to after the endpoint (or null for endpoint processing)toTunnel- tunnel to send to after the endpoint (or null for endpoint or router processing)- Returns:
- true always, as zero-hop gateways forward immediately