Skip to main content

Module zmtp_quic

Module zmtp_quic 

Source
Expand description

ZMTP 3.1 over QUIC transport implementation.

This module implements ZMTP (ZeroMQ Message Transport Protocol) version 3.1 running over QUIC streams. QUIC provides TLS 1.3 encryption at the transport layer, so the ZMTP handshake uses the NULL mechanism (CurveZMQ not needed).

§Protocol Mapping

TCP connection     → QUIC connection (+ TLS 1.3)
TCP byte stream    → Single QUIC bidirectional stream (ordered, reliable)
ZMTP greeting      → Sent as first 64 bytes on the QUIC stream
ZMTP handshake     → NULL mechanism (TLS handles encryption)
ZMTP message frames → Identical framing on the QUIC stream

§ZMTP Frame Format

Flags (1 byte):
  Bit 0 (LSB): MORE — 1 if more frames follow, 0 if last frame
  Bit 1:       LONG — 1 if size is 8-byte uint64, 0 if size is 1-byte uint8
  Bit 2:       COMMAND — 1 = command frame, 0 = message frame
  Bits 3-7:    Reserved (must be 0)

Size:
  LONG=0: 1 byte  (uint8, frames 0–255 bytes)
  LONG=1: 8 bytes (uint64 big-endian, frames up to 2^64 bytes)

Body: exactly `size` bytes

Re-exports§

pub use crate::zmtp_framing::ZmqSocketType;
pub use crate::zmtp_framing::GREETING_SIZE;
pub use crate::zmtp_framing::MECHANISM_NULL;
pub use crate::zmtp_framing::ZMTP_VERSION_MAJOR;
pub use crate::zmtp_framing::ZMTP_VERSION_MINOR;
pub use crate::envelope::EnvelopeVerification;

Structs§

Multipart
ZMQ multipart message (owned).
QuicPull
PULL socket: accepts connections from multiple PUSHers, fans in to single receiver.
QuicPush
PUSH socket: opens connection, sends frames on a persistent bidi stream.
QuicRep
Server-side REP socket over QUIC.
QuicReq
Client-side REQ socket over QUIC.
QuicServiceLoop
Service loop for hosting RequestService over QUIC transport.
QuicSub
Client-side SUB socket over QUIC.
QuicXPub
Server-side XPUB socket over QUIC.
ZmtpCommand
A parsed ZMTP command (with Bytes body for async I/O efficiency).
ZmtpFrame
A parsed ZMTP frame (with Bytes data for async I/O efficiency).
ZmtpStream
ZMTP 3.1 framing over a byte stream.

Constants§

ALPN_ZMTP3
ALPN protocol identifier for ZMTP over QUIC.

Functions§

cert_hash
Compute SHA-256 hash of certificate for browser serverCertificateHashes (base64).
client_tls_pinned
Create a TLS client config that pins a specific server certificate.
client_tls_system_roots
Create a TLS client config that trusts system root certificates.
server_tls_self_signed
Generate a self-signed TLS certificate for development/testing.