Skip to main content

Crate rammux

Crate rammux 

Source
Expand description

Tokio-based asynchronous stream multiplexing over a single byte transport.

rammux lets two peers open many independent virtual byte streams inside one reliable byte stream transport, for example a TCP (mind the head-of-line blocking issue) or a UNIX connection.

Each virtual stream is exposed as a RammuxDuplex, which implements both Sink and Stream. It also allows for graceful downgrade and recovery of the byte stream transport.

The transport itself is driven by RammuxConnection. That connection owns protocol IO, handles stream creation, applies per-stream flow control, sends keepalive PINGs, and performs graceful downgrade back to the underlying transport when rammux is finished.

§Configuration and negotiation

rammux does not define an in-band handshake for transport parameters. Before constructing both peers, the application must ensure that both sides use a compatible RammuxConfig and complementary RammuxRoles.

See examples/negotiation.rs for one way to negotiate config out of band.

§Protocol

See PROTOCOL.md.

§Examples

Usage examples live in the examples directory:

  • negotiation.rs: out-of-band config negotiation
  • flow_control.rs: per-stream flow control and fairness
  • downgrade.rs: graceful downgrade and transport recovery
  • heavy_io.rs: heavier traffic and transport comparisons

Modules§

config
rammux connection configuration.
connection
Types for running rammux protocol on an IO transport.
stream
Types for working with virtual rammux streams.

Structs§

RammuxError
Opaque error originating from a rammux connection.
StreamId
24-bit ID of a rammux stream.