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 --
QuicMessagewithMessageTypediscriminator andbytes::Bytespayload
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
| Type | Description |
|---|---|
QuicClient | QUIC client (native or WASM stub) |
QuicServer | QUIC server (native only) |
ConnectionConfig | Timeout, stream concurrency, and TLS settings |
QuicMessage | Typed message with MessageType and payload |
MessageType | Message type discriminator |
PoolStats | Connection pool statistics |
QuicError | Crate error type |
Feature Flags
| Feature | Default | Description |
|---|---|---|
client | yes | QUIC client support |
server | yes | QUIC server support |
wasm | no | WASM browser client via wasm-bindgen |