Package net.i2p.data.i2cp

The Invisible Internet Client Protocol (I2CP) allows applications simplified access to the I2P network without requiring them to deal with the issues involved with the Invisible Internet Network Protocol (I2NP). Specifically, it defines the wire level protocol as well as semantics for the messages passed between clients and the router for communicating with the router over bidirectional TCP/IP sockets. I2CP does not specify how the client libraries are created, what APIs they expose to applications, or even what language they're written in.

Requirements

I2CP requires that the client can access the router over bidirectional TCP sockets. In nearly all cases, these connections will be over to the local machine.

Threat Model

I2CP does not provide data confidentiality or handle lossy connections beyond what TCP has built in. For this reason, I2CP really should only be run between clients and routers on the same machine or over trusted networks. Secured I2CP transports may be added in the future. I2CP however does not expose any private keys across the wire - proof of authorization to collect messages for a Destination is provided by public key signatures.

Messages

These classes are the currently defined messages in the Invisible Internet Client Protocol (I2CP), though common data structures are located in the I2P Common Data Structure Specification. For simplicity, all I2CP messages begin with the same structure, though that structure is not listed below. Specifically, all I2CP messages transmitted begin with a 4 byte Integer specifying the entire size of the current message's body (the body being what's specified below), followed by a 1 byte Integer specifying the type of message (the id field below), after which the rest of the message is formatted according to the type of message, as specified below.

If there is a fatal error causing either the client or the router to desire to cancel sending a message part way through, it should drop its connection. Administrative sessions are not stateful (aka each administrative message from client to router must provide authentication), but normal client sessions are stateful and survive disconnects. Client sessions expire when either the client sends a DestroySessionMessage or the router times out the session according to its own configurable timer. If a client sends any message other than a CreateSessionMessage when there is no valid session, the router must reply with a SessionStatusMessage specifying that the session is not valid.

Note: the contents and bitbuckets for specific DataStructures are detailed in the I2P Data Structures Spec.

  • Interface Summary 
    Interface Description
    I2CPMessage
    Defines the base functionality of API messages As of 0.9.48, does NOT extend DataStructure.
    I2CPMessageReader.I2CPMessageEventListener
    Defines the different events the reader produces while reading the stream
  • Class Summary 
    Class Description
    AbuseReason
    Defines the structure for why abuse was reported either by the client to the router or by the router to the client
    AbuseSeverity
    Provides a severity level (larger numbers are more severe) in association with a client reporting abusive behavior to the router or the router reporting it to the client
    BandwidthLimitsMessage
    Tell the other side the limits
    BlindingInfoMessage
    Advise the router that the endpoint is blinded.
    CreateLeaseSet2Message
    Like CreateLeaseSetMessage, but supports both old and new LeaseSet types, including LS2, Meta, and Encrypted.
    CreateLeaseSetMessage
    Defines the message a client sends to a router when authorizing the LeaseSet
    CreateSessionMessage
    Defines the message a client sends to a router when establishing a new session.
    DestLookupMessage
    Request the router look up the dest for a hash
    DestReplyMessage
    Response to DestLookupMessage.
    DestroySessionMessage
    Defines the message a client sends to a router when destroying existing session.
    DisconnectMessage
    Defines the message a client sends to a router when destroying existing session.
    GetBandwidthLimitsMessage
    Request the router tells us the current bw limits
    GetDateMessage
    Request the other side to send us what they think the current time is.
    HostLookupMessage
    Request the router look up the dest for a hash or a host.
    HostReplyMessage
    Response to HostLookupMessage.
    I2CPMessageHandler
    Handle messages from the server for the client or vice versa
    I2CPMessageImpl
    Defines the base message implementation.
    I2CPMessageReader
    The I2CPMessageReader reads an InputStream (using I2CPMessageHandler) and passes out events to a registered listener, where events are either messages being received, exceptions being thrown, or the connection being closed.
    MessageId
    Defines the message ID of a message delivered between a router and a client in a particular session.
    MessagePayloadMessage
    Defines the payload message a router sends to the client
    MessageStatusMessage
    Defines the message a router sends to a client about a single message.
    ReceiveMessageBeginMessage
    Defines the message a client sends to a router when asking the router to start sending a message to it.
    ReceiveMessageEndMessage
    Defines the message a client sends to a router when asking the router to start sending a message to it.
    ReconfigureSessionMessage
    Defines the message a client sends to a router when updating the config on an existing session.
    ReportAbuseMessage
    Defines the message a client sends to a router when asking the router what its address visibility is
    RequestLeaseSetMessage
    Defines the message a router sends to a client to request that a leaseset be created and signed.
    RequestVariableLeaseSetMessage
    Defines the message a router sends to a client to request that a leaseset be created and signed.
    SendMessageExpiresMessage
    Same as SendMessageMessage, but with an expiration to be passed to the router As of 0.8.4, retrofitted to use DateAndFlags.
    SendMessageMessage
    Defines the message a client sends to a router to ask it to deliver a new message
    SessionConfig
    Defines the information a client must provide to create a session
    SessionId
    Defines the token passed between the router and client to associate messages with a particular session.
    SessionStatusMessage
    Defines the message a router sends to a client indicating the status of the session.
    SetDateMessage
    Tell the other side what time it is.
  • Exception Summary 
    Exception Description
    I2CPMessageException
    Represent an error serializing or deserializing a message