libp2p.network.connection package

Submodules

libp2p.network.connection.exceptions module

exception libp2p.network.connection.exceptions.RawConnError

Bases: IOException

libp2p.network.connection.net_connection_interface module

class libp2p.network.connection.net_connection_interface.INetConn

Bases: Closer

event_started: Event
abstract get_streams() Tuple[INetStream, ...]
muxed_conn: IMuxedConn
abstract async new_stream() INetStream

libp2p.network.connection.raw_connection module

class libp2p.network.connection.raw_connection.RawConnection(stream: ReadWriteCloser, initiator: bool)

Bases: IRawConnection

async close() None
is_initiator: bool
async read(n: int | None = None) bytes

Read up to n bytes from the underlying stream. This call is delegated directly to the underlying self.reader.

Raise RawConnError if the underlying connection breaks

stream: ReadWriteCloser
async write(data: bytes) None

Raise RawConnError if the underlying connection breaks.

libp2p.network.connection.raw_connection_interface module

class libp2p.network.connection.raw_connection_interface.IRawConnection

Bases: ReadWriteCloser

A Raw Connection provides a Reader and a Writer.

is_initiator: bool

libp2p.network.connection.swarm_connection module

class libp2p.network.connection.swarm_connection.SwarmConn(muxed_conn: IMuxedConn, swarm: Swarm)

Bases: INetConn

async close() None
event_closed: Event
get_streams() Tuple[NetStream, ...]
property is_closed: bool
muxed_conn: IMuxedConn
async new_stream() NetStream
remove_stream(stream: NetStream) None
async start() None
streams: Set[NetStream]
swarm: Swarm

Module contents