This part of the documentation covers all the interfaces of i2plib.

Network connections¶

These 4 coroutines provide everything you need for making connections inside I2P network. All of them return a tuple of transports (reader, writer) to deal with.

The reader returned is an asyncio.StreamReader instance; the writer is an asyncio.StreamWriter instance.

i2plib. create_session ( session_name, sam_address=('127.0.0.1', 7656), loop=None, style='STREAM', signature_type=7, destination=None, options={} ) [source] ¶ A coroutine used to create a new SAM session. Parameters: session_name – Session nick name

– Session nick name sam_address – (optional) SAM API address

– (optional) SAM API address loop – (optional) Event loop instance

– (optional) Event loop instance style – (optional) Session style, can be STREAM, DATAGRAM, RAW

– (optional) Session style, can be STREAM, DATAGRAM, RAW signature_type – (optional) If the destination is TRANSIENT, this signature type is used

– (optional) If the destination is TRANSIENT, this signature type is used destination – (optional) Destination to use in this session. Can be a base64 encoded string, i2plib.Destination instance or None. TRANSIENT destination is used when it is None.

– (optional) Destination to use in this session. Can be a base64 encoded string, instance or None. TRANSIENT destination is used when it is None. options – (optional) A dict object with i2cp options Returns: A (reader, writer) pair

i2plib. stream_connect ( session_name, destination, sam_address=('127.0.0.1', 7656), loop=None ) [source] ¶ A coroutine used to connect to a remote I2P destination. Parameters: session_name – Session nick name

– Session nick name destination – I2P destination to connect to

– I2P destination to connect to sam_address – (optional) SAM API address

– (optional) SAM API address loop – (optional) Event loop instance Returns: A (reader, writer) pair

i2plib. stream_accept ( session_name, sam_address=('127.0.0.1', 7656), loop=None ) [source] ¶ A coroutine used to accept a connection from the I2P network. Parameters: session_name – Session nick name

– Session nick name sam_address – (optional) SAM API address

– (optional) SAM API address loop – (optional) Event loop instance Returns: A (reader, writer) pair