Libp2pQuicTransport class
A libp2p transport backed by QUIC.
Libp2pQuicTransport wraps a QuicEndpoint and exposes libp2p-style listen and dial APIs. It parses Multiaddr values to extract IP addresses and UDP ports, binds the endpoint, and bridges raw QuicConnection objects into Libp2pQuicConnection wrappers.
Per the libp2p QUIC specification, the security handshake (Noise or TLS 1.3 with libp2p extension) runs inside the QUIC crypto frame stream. This transport layer handles addressing and connection establishment; the actual security handshake is performed by the libp2p security upgrade layer above it.
Example
final transport = Libp2pQuicTransport();
// Listen on a multiaddr.
final incoming = await transport.listen(
Multiaddr.parse('/ip4/127.0.0.1/udp/0/quic-v1'),
);
incoming.listen((conn) {
print('Accepted connection: ${conn.quicConnection}');
conn.close();
});
// Dial a remote peer.
final conn = await transport.dial(
Multiaddr.parse('/ip4/192.168.1.10/udp/4001/quic-v1'),
);
conn.send(Uint8List.fromList([1, 2, 3]));
await transport.close();
See also:
- Libp2pQuicConnection — wrapper around an established QUIC connection.
- QuicEndpoint — the underlying QUIC endpoint.
- Multiaddr — libp2p addressing format.
- libp2p QUIC spec — https://github.com/libp2p/specs/tree/master/quic
Constructors
-
Libp2pQuicTransport({List<
String> alpnProtocols = const ['libp2p']})
Properties
-
alpnProtocols
→ List<
String> -
ALPN protocols advertised during the TLS handshake.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- isClosed → bool
-
Whether the transport has been closed.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
close(
) → Future< void> - Close the transport and all active listeners.
-
dial(
Multiaddr multiaddr) → Future< Libp2pQuicConnection> -
Dial a remote peer at
multiaddr. -
listen(
Multiaddr multiaddr) → Future< Stream< Libp2pQuicConnection> > -
Listen on the given
multiaddr. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited