Available on crate feature
std only.Expand description
Production Adaptive Compression
Real compression using LZ4 (lz4_flex) and Zstd:
- Performance tier: LZ4 frame compression (~4 GB/s decompress, ~2 GB/s compress)
- Standard tier: Zstd level 1 (~500 MB/s compress, ratio ~2.5x)
- Constrained tier: off (CPU > bandwidth)
Auto-probe: if the compression ratio stays below probe_threshold after the
first probe_samples packets, compression self-disables (CPU not worth it).
Minimum payload worth compressing = 64 bytes (below that the overhead dominates).
Structs§
- Adaptive
Compressor - Adaptive compressor with auto-probe.
- Compression
Stats - Compression statistics for auto-probe
Enums§
- Compression
Algo - Compression algorithm
- Compression
Error - Compression errors
Constants§
- MAX_
DECOMPRESSED_ LEN - Default upper bound on decompressed output (16 MiB). A conservative ceiling on
the largest plaintext a single frame may expand to; the established-session
TcpSessionTransportframe cap is tighter still (4 MiB), so this never gates legitimate traffic. Decompression is an asymmetric operation: a few KiB of crafted LZ4/Zstd can expand to gigabytes (a “decompression bomb”).AdaptiveCompressor::decompressenforces this cap unconditionally; callers that need a different bound useAdaptiveCompressor::decompress_with_limit.