# Package net.i2p.router.tunnel

Core tunnel management, message processing, and encryption for I2P's anonymous routing system.

See: Description

- Interface Summary
  Interface | Description
  --- | ---
  FragmentHandler.DefragmentedReceiver | Receive messages out of the tunnel endpoint.
  IVValidator | Provide a generic interface for IV validation which may be implemented through something as simple as a hashtable or more a complicated bloom filter.
  TunnelGateway.QueuePreprocessor | Interface for preprocessing queued tunnel messages.
  TunnelGateway.Receiver | Interface for receiving encrypted tunnel data.
  TunnelGateway.Sender | Interface for sending preprocessed tunnel data.

- Class Summary
  Class | Description
  --- | ---
  BatchedPreprocessor | Batching preprocessor that will briefly delay the sending of a message if it doesn't fill up a full tunnel message, in which case it queues up an additional flush task.
  BatchedRouterPreprocessor | Honor the 'batchFrequency' tunnel pool setting or the 'router.batchFrequency' router config setting, and track fragmentation.
  BloomFilterIVValidator | Manage the IV validation for all of the router's tunnels by way of a big decaying bloom filter.
  DummyValidator | IV validator that accepts all initialization vectors without validation.
  FragmentedMessage | Gather fragments of I2NPMessages at a tunnel endpoint, making them available for reading when complete.
  FragmentHandler | Handle fragments at the endpoint of a tunnel, peeling off fully completed I2NPMessages when they arrive, and dropping fragments if they take too long to arrive.
  HopConfig | Defines the general configuration for a hop in a tunnel.
  HopProcessor | Take a received tunnel message, verify that it isn't a duplicate, and translate it into what the next hop will want.
  InboundEndpointProcessor | Receive the inbound tunnel message, removing all of the layers added by earlier hops to recover the preprocessed data sent by the gateway.
  InboundGatewayProcessor | Override the hop processor to seed the message with a random IV.
  InboundGatewayReceiver | Handle messages at the IBGW.
  InboundMessageDistributor | When a message arrives at the inbound tunnel endpoint, this distributor honors the instructions (safely)
  InboundSender | Receive the preprocessed data for an inbound gateway, encrypt it, and forward it on to the first hop.
  OutboundGatewayMessage | Stores all the state for an unsent or partially-sent message
  OutboundGatewayProcessor | Turn the preprocessed tunnel data into something that can be delivered to the first hop in the tunnel.
  OutboundMessageDistributor | When a message arrives at the outbound tunnel endpoint, this distributor honors the instructions.
  OutboundReceiver | We are the outbound gateway - we created this outbound tunnel.
  OutboundSender | Receive the preprocessed data for an outbound gateway, encrypt all of the layers, and forward it on to the first hop.
  OutboundTunnelEndpoint | We are the end of an outbound tunnel that we did not create.
  PendingGatewayMessage | Stores all the state for an unsent or partially-sent message
  PumpedTunnelGateway | This class represents a tunnel gateway with multiple hops that accepts messages, then coalesces and fragments them before sending them down the tunnel.
  ThrottledPumpedTunnelGateway | Specialized pumped tunnel gateway for inbound gateways (IBGWs) that throttles messages by checking bandwidth usage before queuing them.
  TrivialPreprocessor | Do the simplest thing possible for preprocessing - for each message available, turn it into the minimum number of fragmented preprocessed blocks, sending each of those out.
  TunnelCreatorConfig | Coordinate the info that the tunnel creator keeps track of, including what peers are in the tunnel and what their configuration is See PooledTunnelCreatorConfig for the non-abstract class
  TunnelDispatcher | Handle the actual processing and forwarding of messages through the various tunnels.
  TunnelGateway | Serve as the gatekeeper for a tunnel, accepting messages, coalescing and/or fragmenting them before wrapping them up for tunnel delivery.
  TunnelGatewayPumper | TunnelGatewayPumper runs a pool of threads that process PumpedTunnelGateway instances which need messages pushed through preprocessing and sending.
  TunnelGatewayZeroHop | Serve as the gatekeeper for a tunnel with no hops, either inbound or outbound.
  TunnelParticipant | Participates in a tunnel at an intermediate hop (not gateway or endpoint).

- Enum Summary
  Enum | Description
  --- | ---
  TunnelDispatcher.Location | Location in the tunnel for RED logic

## Package net.i2p.router.tunnel Description

Core tunnel management, message processing, and encryption for I2P's anonymous routing system.

This package provides the complete implementation of I2P's tunnel system, which forms the backbone of anonymous communication in the I2P network. Tunnels provide bidirectional, encrypted paths through multiple routers, ensuring both anonymity and message delivery reliability.

Key Components:

- TunnelDispatcher - Central coordinator for tunnel message routing
- TunnelGateway - Manages tunnel entry and exit points
- TunnelParticipant - Handles participation in tunnels
- TunnelCreator - Manages tunnel creation and setup
- TunnelPool - Manages collections of tunnels
- TunnelInfo - Contains tunnel metadata and configuration
- HopProcessor - Processes messages at each tunnel hop
- TunnelValidator - Validates tunnel integrity and authenticity

Main Functionality:

- Tunnel creation and management
- Message encryption and decryption at each hop
- Five tunnel hop types: IBGW, IBEP, OBEP, OBGW, Middle
- Message validation and authentication
- Queueing and throttling for performance management
- Tunnel failure detection and recovery
- Message routing and forwarding
- Tunnel statistics and monitoring

Tunnel Hop Types:

- Inbound Gateway (IBGW) - Entry point for inbound tunnels
- Inbound Endpoint (IBEP) - Exit point for inbound tunnels
- Outbound Endpoint (OBEP) - Entry point for outbound tunnels
- Outbound Gateway (OBGW) - Exit point for outbound tunnels
- Middle Hop - Intermediate router in tunnel path

Usage Notes:

- Tunnel building operations are handled in the pool package
- Essential for I2P's anonymity and routing capabilities
- Integrates with transport layer for message delivery
- Provides the foundation for client communication