Skip to main content

Module mux

Module mux 

Source
Expand description

HTTP/1.1 and HTTP/2 multiplexing layer.

This module unifies HTTP/1.1 and HTTP/2 behind a single Mux session state machine that integrates with sozu’s mio event loop. The key types:

  • Mux: The top-level session state, generic over socket (TcpStream or FrontRustls) and listener. Implements SessionState.
  • Connection: Enum dispatching to ConnectionH1 or ConnectionH2 for protocol-specific readable/writable logic.
  • Stream: Per-request state with front/back kawa buffers, metrics, and lifecycle tracking. Shared between H1 and H2 paths.
  • Context: Per-session context (cluster, backends, routing, timeouts).

The H2 implementation handles RFC 9113 framing, HPACK (RFC 7541), flow control, flood detection (CVE-2023-44487, CVE-2019-9512/9514/9515/9518, CVE-2024-27316), and graceful shutdown (double-GOAWAY per RFC 9113 §6.8).

Re-exports§

pub use crate::protocol::mux::answers::terminate_default_answer;
pub use crate::protocol::mux::connection::Connection;
pub use crate::protocol::mux::debug::DebugEvent;
pub use crate::protocol::mux::debug::DebugHistory;
pub use crate::protocol::mux::parser::H2Error;
pub use crate::protocol::mux::router::Router;
pub use crate::protocol::mux::stream::Stream;
pub use crate::protocol::mux::stream::StreamParts;
pub use crate::protocol::mux::stream::StreamState;

Modules§

answers
Default-answer helpers shared by the H1 and H2 mux paths.
auth
HTTP Basic authentication helpers shared by the H1 and H2 mux paths.
connection
Protocol-agnostic frontend/backend connection wrapper.
debug
Debug history ring buffer and event enum.
parser
H2 frame parser (nom-based).
router
Backend routing and connection reuse for the mux layer.
stream
Per-request stream state shared by the H1 and H2 mux paths.

Structs§

ConnectionH1
HTTP/1.1 connection handler within the mux layer.
ConnectionH2
Context
H2ByteAccounting
Byte accounting for connection overhead attribution.
H2ConnectionConfig
Configurable H2 connection tuning parameters.
H2DrainState
Connection draining state for graceful shutdown.
H2FloodConfig
Configurable thresholds for H2 flood detection.
H2FlowControl
Connection-level flow control state (RFC 9113 §6.9).
Mux

Enums§

BackendStatus
MuxResult
Position

Traits§

Endpoint

Type Aliases§

MuxClear
MuxTls