cmux is a TCP connection multiplexer and layer four protocol dispatcher. It routes incoming network traffic to different backend handlers by analyzing the initial bytes of the payload, allowing multiple network protocols to share a single IP address and port.
The project identifies traffic using protocol signatures, byte-prefix matching, and header-value evaluation. It supports the detection of specific protocols including TLS, HTTP/1, and HTTP/2, and enables bidirectional handshaking where data can be sent back to a client during the matching phase.
The routing system includes a first-match dispatch priority and a catch-all fallback handler for connections that do not meet specific criteria. Traffic management capabilities include configurable read timeouts for initial payload inspection and custom error handling for listener failures.