tokio_h2mux/
lib.rs

1//! Multiplexing streams over HTTP/2, built upon [h2](https://docs.rs/h2/).
2//!
3//! Unlike streams opened via the standard HTTP CONNECT method, h2mux streams can be written to
4//! with data immediately after being opened by the client, without waiting 1 extra RTT for the
5//! server to respond to the request.
6//!
7//! It supports auto-scaling HTTP/2 window size based on BDP estimation, ported from [hyper](https://docs.rs/hyper/)
8//! with some params tuned.
9
10use thiserror::Error;
11
12pub mod client;
13pub mod server;
14
15mod ping;
16mod stream;
17mod utils;
18
19pub use crate::{client::InFlightH2Stream, stream::H2Stream};
20
21/// hyper::proto::h2::SPEC_WINDOW_SIZE: Default initial stream window size defined in HTTP2 spec.
22const SPEC_WINDOW_SIZE: u32 = 65_535;
23
24#[derive(Error, Debug)]
25pub enum Error {
26    #[error("h2 layer error")]
27    H2Error(#[from] h2::Error),
28    #[error("pong timed out")]
29    KeepAliveTimedOut,
30}