libp2p.network.connection package
Submodules
libp2p.network.connection.exceptions module
- exception libp2p.network.connection.exceptions.RawConnError
Bases:
IOException
libp2p.network.connection.raw_connection module
- class libp2p.network.connection.raw_connection.RawConnection(stream: ReadWriteCloser, initiator: bool)
Bases:
IRawConnection- get_remote_address() tuple[str, int] | None
Delegate to the underlying stream’s get_remote_address method.
- async read(n: int | None = None) bytes
Read up to
nbytes from the underlying stream. This call is delegated directly to the underlyingself.reader.Raise RawConnError if the underlying connection breaks
- stream: ReadWriteCloser
libp2p.network.connection.swarm_connection module
- class libp2p.network.connection.swarm_connection.SwarmConn(muxed_conn: IMuxedConn, swarm: Swarm)
Bases:
INetConn- event_closed: Event
- get_streams() tuple[NetStream, ...]
Retrieve all active streams associated with this connection.
- Returns:
A tuple containing instances of INetStream.
- get_transport_addresses() list[Multiaddr]
Retrieve the transport addresses used by this connection.
Returns
- list[Multiaddr]
A list of multiaddresses used by the transport.
- muxed_conn: IMuxedConn