QuicConnection class

Adapter implementing libp2p.TransportConn around a quic_lib Libp2pQuicConnection.

This is a foundation-level implementation. The QUIC handshake and stream multiplexing are handled internally by quic_lib; this adapter exposes the connection lifecycle and metadata required by the libp2p transport interface.

Implemented types

Constructors

QuicConnection(Libp2pQuicConnection _delegate, {required MultiAddr localAddr, required MultiAddr remoteAddr, required bool isServer})
Creates a QUIC connection adapter.

Properties

hashCode → int
The hash code for this object.
no setterinherited
id → String
ID returns an identifier that uniquely identifies this Conn within this host, during this run. Connection IDs may repeat across restarts.
no setteroverride
isClosed → bool
IsClosed returns whether a connection is fully closed, so it can be garbage collected.
no setteroverride
isEstablished → bool
Whether the QUIC handshake is complete.
no setter
localMultiaddr → MultiAddr
LocalMultiaddr returns the local Multiaddr associated with this connection
no setteroverride
localPeer → PeerId
LocalPeer returns our peer ID
no setteroverride
quicConnection → Object
The underlying quic_lib connection object.
no setter
remoteMultiaddr → MultiAddr
RemoteMultiaddr returns the remote Multiaddr associated with this connection
no setteroverride
remotePeer → PeerId
The remote peer identity for this QUIC connection.
no setteroverride
remotePublicKey → Future<PublicKey?>
RemotePublicKey returns the public key of the remote peer.
no setteroverride
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
scope → ConnScope
Scope returns the user view of this connection's resource scope
no setteroverride
socket → Socket
no setteroverride
stat → ConnStats
Stat stores metadata pertaining to this conn.
no setteroverride
state → ConnState
ConnState returns information about the connection state.
no setteroverride
streams → Future<List<P2PStream>>
GetStreams returns all open streams over this conn.
no setteroverride

Methods

close() → Future<void>
Closes the connection
override
getQuicStream(int id) → QuicStream?
Returns the QUIC stream with the given id, or null if it does not exist.
newStream(Context context) → Future<P2PStream>
NewStream constructs a new Stream over this conn.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyActivity() → void
Notifies that activity has occurred on this transport connection, potentially due to activity on a multiplexed stream over it. This can be used by multiplexers to inform the connection manager.
override
openBidirectionalStream() → int
Opens a new bidirectional stream and returns its stream ID.
read([int? length]) → Future<Uint8List>
Reads data from the connection. If length is provided, reads exactly that many bytes. Otherwise, reads whatever is available.
override
setReadTimeout(Duration timeout) → void
Sets a timeout for read operations.
override
setWriteTimeout(Duration timeout) → void
Sets a timeout for write operations.
override
toString() → String
A string representation of this object.
inherited
verifyPeer() → bool
Validates that the peer's selected ALPN is acceptable and a PeerId has been derived.
verifyPeerCertificate(List<int> certBytes, {PeerId? expectedPeerId}) → Future<bool>
Verifies the peer's certificate using the libp2p TLS extension.
verifyPeerFromHandshake() → Future<bool>
Verifies the peer using the certificate captured during the QUIC handshake.
write(Uint8List data) → Future<void>
Writes data to the connection.
override

Operators

operator ==(Object other) → bool
The equality operator.
inherited