Struct quinn_proto::PartialDecode
source · pub struct PartialDecode { /* private fields */ }
Expand description
Decodes a QUIC packet’s invariant header
Due to packet number encryption, it is impossible to fully decode a header
(which includes a variable-length packet number) without crypto context.
The crypto context (represented by the Crypto
type in Quinn) is usually
part of the Connection
, or can be derived from the destination CID for
Initial packets.
To cope with this, we decode the invariant header (which should be stable across QUIC versions), which gives us the destination CID and allows us to inspect the version and packet type (which depends on the version). This information allows us to fully decode and decrypt the packet.
Implementations§
source§impl PartialDecode
impl PartialDecode
sourcepub fn new(
bytes: BytesMut,
cid_parser: &(impl ConnectionIdParser + ?Sized),
supported_versions: &[u32],
grease_quic_bit: bool,
) -> Result<(Self, Option<BytesMut>), PacketDecodeError>
pub fn new( bytes: BytesMut, cid_parser: &(impl ConnectionIdParser + ?Sized), supported_versions: &[u32], grease_quic_bit: bool, ) -> Result<(Self, Option<BytesMut>), PacketDecodeError>
Begin decoding a QUIC packet from bytes
, returning any trailing data not part of that packet
sourcepub fn dst_cid(&self) -> &ConnectionId
pub fn dst_cid(&self) -> &ConnectionId
The destination connection ID of the packet