i2pplus

Streaming (streaming/)

Implementation of I2P’s streaming protocol, providing TCP-like reliable, ordered, bidirectional connections over I2P’s unreliable garlic messages.

How It Works

The streaming library abstracts I2P’s message-based transport into familiar socket semantics:

  1. Connection - Client creates an I2PSocket via I2PSocketManager
  2. Handshake - Outbound destination created, connected to peer’s destination
  3. Data - Messages fragmented, encrypted, sent through tunnel hops
  4. Ack/Nak - Acks confirm delivery, naks trigger retransmission
  5. Congestion - Sliding window limits in-flight messages

Retransmission Strategy

Unlike TCP’s cumulative ACKs, I2P uses selective ACKs per-packet:

Key Classes

Class Purpose
Connection Per-stream state (seq, window, RTT)
ConnectionManager All connections to a destination
PacketHandler Fragment/reassemble, encrypt/decrypt
MessageHandler garlic message encoding

Differences from TCP

See ministreaming/ for the client API (I2PSocket, I2PServerSocket).

Packages

Building

# Gradle
./gradlew :apps:streaming:jar

# Ant (from repo root)
ant buildStreaming