Expand description
ringline-quic — QUIC protocol support via quinn-proto.
This crate wraps quinn-proto’s sans-IO QUIC
state machine and exposes an event-based QuicEndpoint API.
§Example
ⓘ
use ringline_quic::{QuicConfig, QuicEndpoint, QuicEvent};
// Feed incoming datagrams:
quic.handle_datagram(Instant::now(), data, peer);
while let Some(event) = quic.poll_event() {
match event {
QuicEvent::NewConnection(conn) => { /* ... */ }
QuicEvent::StreamReadable { conn, stream } => {
let mut buf = [0u8; 4096];
let (n, fin) = quic.stream_recv(conn, stream, &mut buf)?;
quic.stream_send(conn, stream, &buf[..n])?;
}
_ => {}
}
}
// Drain outgoing packets:
while let Some(pkt) = quic.poll_send() {
match pkt.segment_size {
Some(seg) => udp.send_to_gso(pkt.destination, &pkt.data, seg)?,
None => udp.send_to(pkt.destination, &pkt.data)?,
}
}Re-exports§
pub use config::QuicConfig;pub use endpoint::BatchGuard;pub use endpoint::Datagrams;pub use endpoint::OutgoingPacket;pub use endpoint::QuicEndpoint;pub use error::Error;pub use event::QuicConnId;pub use event::QuicEvent;
Modules§
Structs§
- Connection
Stats - Connection statistics
- Frame
Stats - Number of frames transmitted or received of each frame type
- Path
Stats - Statistics related to a transmission path
- Stream
Id - Identifier for a stream within a particular connection
- UdpStats
- Statistics about UDP datagrams transmitted or received on a connection
- VarInt
- An integer less than 2^62
Enums§
- Dir
- Whether a stream communicates data in both directions or only from the initiator
- Read
Error - Errors triggered when reading from a recv stream
- Write
Error - Errors triggered while writing to a send stream