Skip to content

spt-quic

High-performance QUIC transport layer for SPT with WASM support

Overview

spt-quic provides a production-ready QUIC transport implementation using the quinn library for native targets, with a WASM-compatible stub for browser-based agents. It supports both client and server roles with TLS via rustls, connection pooling, and configurable stream concurrency. The crate compiles as both cdylib (for WASM) and rlib (for native).

Key Features

  • Quinn-based QUIC -- production-grade QUIC transport with rustls TLS
  • Client and server -- both roles with self-signed certificate generation via rcgen
  • WASM support -- browser-compatible client via wasm-bindgen when targeting wasm32
  • Connection pooling -- pool statistics and configurable idle timeouts
  • Typed messaging -- QuicMessage with MessageType discriminator and bytes::Bytes payload

Dependencies

No internal SPT crate dependencies. Uses quinn 0.11 + rustls 0.23 for native QUIC, wasm-bindgen for browser targets.

Usage

rust
use spt_quic::{QuicClient, QuicServer, ConnectionConfig, init};

let config = ConnectionConfig::default();
init(&config).unwrap();

// Native client
let client = QuicClient::new(config);

API Reference

Core Types

TypeDescription
QuicClientQUIC client (native or WASM stub)
QuicServerQUIC server (native only)
ConnectionConfigTimeout, stream concurrency, and TLS settings
QuicMessageTyped message with MessageType and payload
MessageTypeMessage type discriminator
PoolStatsConnection pool statistics
QuicErrorCrate error type

Feature Flags

FeatureDefaultDescription
clientyesQUIC client support
serveryesQUIC server support
wasmnoWASM browser client via wasm-bindgen

Released under the MIT License.