Skip to main content

quic_parser/
lib.rs

1/* src/lib.rs */
2
3//! Zero-copy QUIC Initial packet parser with optional payload decryption.
4//!
5//! This crate provides three layers of functionality:
6//!
7//! **Layer 1 — Header parsing** (always available, zero dependencies beyond `thiserror`):
8//! parse QUIC Initial packet headers, peek at connection IDs, and decode varints.
9//!
10//! **Layer 2 — Decryption** (requires `ring` or `aws-lc-rs` feature):
11//! derive keys and decrypt Initial packet payloads for QUIC v1 and v2.
12//!
13//! **Layer 3 — Frame extraction** (requires `ring` or `aws-lc-rs` feature):
14//! extract CRYPTO frames from decrypted payloads and reassemble them into a
15//! contiguous byte stream suitable for TLS ClientHello parsing.
16
17#[cfg(all(feature = "ring", feature = "aws-lc-rs"))]
18compile_error!(
19	"features `ring` and `aws-lc-rs` are mutually exclusive; enable only one crypto backend"
20);
21
22mod error;
23mod header;
24mod varint;
25
26#[cfg(any(feature = "ring", feature = "aws-lc-rs"))]
27mod crypto;
28
29#[cfg(any(feature = "ring", feature = "aws-lc-rs"))]
30mod frame;
31
32pub use error::Error;
33pub use header::{InitialHeader, parse_initial, peek_long_header_dcid, peek_short_header_dcid};
34pub use varint::read_varint;
35
36#[cfg(any(feature = "ring", feature = "aws-lc-rs"))]
37pub use crypto::decrypt_initial;
38
39#[cfg(any(feature = "ring", feature = "aws-lc-rs"))]
40pub use frame::{CryptoFrame, parse_crypto_frames, reassemble_crypto_stream};