Crate libp2p_quic
source ·Expand description
Implementation of the QUIC transport protocol for libp2p.
Usage
Example:
use libp2p_quic as quic;
use libp2p_core::{Multiaddr, Transport};
let keypair = libp2p_core::identity::Keypair::generate_ed25519();
let quic_config = quic::Config::new(&keypair);
let mut quic_transport = quic::async_std::Transport::new(quic_config);
let addr = "/ip4/127.0.0.1/udp/12345/quic-v1".parse().expect("address should be valid");
quic_transport.listen_on(addr).expect("listen error.");
The GenTransport
struct implements the libp2p_core::Transport
. See the
documentation of libp2p_core
and of libp2p in general to learn how to use the
Transport
trait.
Note that QUIC provides transport, security, and multiplexing in a single protocol. Therefore, QUIC connections do not need to be upgraded. You will get a compile-time error if you try. Instead, you must pass all needed configuration into the constructor.
Modules
Structs
Config for the transport.
Dialing a remote peer failed.
A QUIC connection currently being negotiated.
State for a single opened QUIC connection.
Error on an established
Connection
.Implementation of the
Transport
trait for QUIC.A single stream on a connection
Enums
Errors that may happen on the
GenTransport
or a single Connection
.Traits
Provider for non-blocking receiving and sending on a
std::net::UdpSocket
and spawning tasks.