v0.6.0
⚡ Architectural Leap: Epoll Rewrite & Ultra-Optimization
This release fundamentally reimagines the core of mtproto.zig. The entire networking layer has been rewritten from a thread-per-connection model to a native Linux epoll event loop with a pre-allocated connection pool and non-blocking state machine. The result is extreme connection density at minimal resource cost.
🚀 Highlights
Epoll Event Loop
Fully non-blocking I/O on a single thread. The proxy now scales to tens of thousands of concurrent connections while keeping latency under 10 ms.
Extreme Memory Efficiency
- Baseline RSS under 1 MB — the smallest footprint among all tested MTProto proxy implementations.
- 8.8 MB RSS at 2,000 active TLS-auth connections — ~90% more efficient than Go/Rust alternatives.
- 49 MB RSS at 12,000 idle held sockets — 1.5–2.5× less than C-based implementations.
- On-demand heap allocation for idle connections; slab-based
MessageQueuebuffer pooling for active relay.
Protocol Hardening & DPI Evasion
- DRS (Dynamic Record Sizing): TLS record sizes ramp from 1,369 → 16,384 bytes after warmup, mimicking real Chrome/Firefox browser behavior to resist fingerprinting.
- TCP MSS=88: Forces ClientHello fragmentation across 6 TCP packets, breaking ISP DPI reassembly.
- Split-TLS: 1-byte application-level record chunking to defeat passive DPI signatures.
- Zero-RTT Cloaking: Local Nginx deployed on-the-fly to defeat active probing timing analysis.
Additional Improvements
- Configurable TCP
listenbacklog (default 4096) for high-traffic deployments. - Startup capacity estimate printed at boot.
- IPv4-only host support (graceful fallback when IPv6 is unavailable).
- Automatic MiddleProxy metadata refresh from Telegram endpoints with bundled fallback.
📊 Benchmark Snapshot (VPS 1 vCPU / 1 GB RAM, Ubuntu 24.04)
Baseline Footprint
| Proxy | Language | Binary | Baseline RSS | Startup |
|---|---|---|---|---|
| mtproto.zig | Zig | 177 KB | 0.75 MB | < 10 ms |
| Official MTProxy | C | 524 KB | 8.0 MB | < 10 ms |
| Teleproxy | C | 14 MB | 4.5 MB | ~ 30 ms |
| Telemt | Rust | 15 MB | 12.1 MB | ~ 5-6 s |
| mtg | Go | 13 MB | 11.6 MB | ~ 30 ms |
| mtprotoproxy | Python | N/A | 34.9 MB | ~ 800 ms |
TLS-auth Active Memory @ 2,000 Connections
| Proxy | RSS @ 2000 | Established | Status |
|---|---|---|---|
| mtproto.zig | 8,832 KB | 2,000 | ✅ stable |
| Teleproxy | 20,952 KB | 2,000 | ✅ stable |
| Official MTProxy | 23,296 KB | 2,000 | ✅ stable |
| Telemt | 38,272 KB | 2,000 | ✅ stable |
| mtg | 55,296 KB | 0 | ⚠ partial |
Idle Memory @ 12,000 Held Sockets
| Proxy | RSS @ 12000 | Established | Status |
|---|---|---|---|
| mtproto.zig | 49,024 KB | 12,000 | ✅ stable |
| Telemt | 70,032 KB | 11,023 | ⚠ partial |
| Official MTProxy | 74,116 KB | 12,000 | ✅ stable |
| Teleproxy | 77,864 KB | 12,000 | ✅ stable |
| mtg | 97,792 KB | 7,287 | ⚠ partial |
Built with pure Zig 0.15.2 — zero external dependencies.