v0.9.1
sleep3r/mtproto.zigv0.9.1Apr 7, 2026by sleep3r
Upgrading?
AI Summary
Major performance and security hardening for relay and MiddleProxy paths.
Key Highlights
- Randomized FakeTLS fingerprinting
- Improved rate limiter with salted hashing
- Optimized replay cache and memory model
- Removed runtime dependency on external `curl`
- Added `force_media_middle_proxy` config option
New Features
- Security hardening
- Performance optimizations
- Config control for media routing
Full Release Notes
## [0.9.1](https://github.com/sleep3r/mtproto.zig/compare/v0.9.0...v0.9.1) (2026-04-07) ### 🇷🇺 Release notes (RU) **Что решает этот релиз** - Закрывает набор уязвимых/хрупких мест в relay и MiddleProxy-пути (DPI fingerprinting, collision-sensitive rate limiting, replay-cache CPU pressure, error-path cleanup). - Уменьшает CPU и RAM накладные расходы в обязательном MiddleProxy-сценарии (медиа, промо-каналы, non-premium аккаунты). - Убирает внешнюю зависимость от `curl` в runtime-пути. **Что изменено** - **FakeTLS fingerprint hardening**: шаблон ServerHello/AppData теперь рандомизируется на старте процесса, а не фиксируется одним compile-time fingerprint. - **MiddleProxy safety**: добавлена строгая валидация длины C2S payload (выравнивание), чтобы исключить риск некорректного padding path. - **Rate limiter hardening**: переработан subnet limiter (salted hashing + open addressing + 65k buckets), устойчивее к коллизиям. - **Replay cache optimization**: убран mutex + линейный поиск, заменено на фиксированную хеш-структуру с предсказуемым временем доступа. - **FD cleanup fix**: устранен leak-сценарий при ошибках в `startConnectUpstream`. - **MiddleProxy memory model**: временные C2S/S2C out-буферы вынесены из per-connection контекста в shared event-loop scratch buffers; обновлен RAM clamp и предупреждения. - **S2C parser perf**: compaction буфера теперь делается один раз за проход, без лишних повторных сдвигов. - **Relay write path**: отправка TLS header+payload оптимизирована через `writev`. - **Crypto perf**: в CBC кэшируются key schedules, S2C decrypt выполняется батчами. - **Runtime fetches**: вызовы внешнего `curl` заменены на `std.http.Client` (public IP + middle-proxy metadata). - **Config control**: добавлен `force_media_middle_proxy` (по умолчанию `true`) для явного управления media-routing политикой. - **Stability guardrail**: добавлен startup warning, если бинарь работает на software AES backend. - **Regression handling**: агрессивный relay batching, вызвавший проблемы с подключениями/handshake fairness, исключен из релиза. **Важно** - Поведение по умолчанию для media-пути сохранено (`force_media_middle_proxy = true`). - Конфиг-миграция не требуется. - Для минимальной CPU-нагрузки рекомендована сборка с аппаратным AES (`-Dcpu=x86_64_v3` или `-Dcpu=native`). ### 🇬🇧 Release notes (EN) **What this release addresses** - Hardens multiple fragile/security-sensitive points in relay and MiddleProxy paths (DPI fingerprinting, collision-prone rate limiting, replay-cache CPU pressure, error-path cleanup). - Reduces CPU and RAM overhead in mandatory MiddleProxy scenarios (media, promo channels, non-premium accounts). - Removes runtime dependency on external `curl`. **What changed** - **FakeTLS fingerprint hardening**: ServerHello/AppData template is now randomized per process at startup instead of using a global compile-time fingerprint. - **MiddleProxy safety**: strict C2S payload alignment validation added to prevent unsafe padding paths. - **Rate limiter hardening**: subnet limiter redesigned (salted hashing + open addressing + 65k buckets), more collision-resistant. - **Replay cache optimization**: mutex + linear scan replaced with a fixed hash structure with predictable lookup time. - **FD cleanup fix**: resolved an upstream FD leak path in `startConnectUpstream` failure handling. - **MiddleProxy memory model**: temporary C2S/S2C output buffers moved from per-connection context to shared event-loop scratch buffers; RAM clamp/warnings aligned with the new model. - **S2C parser perf**: buffer compaction now happens once per parse pass instead of repeated shifts. - **Relay write path**: TLS header+payload emission optimized via `writev`. - **Crypto perf**: CBC key schedules are cached and S2C decrypt is batched. - **Runtime fetches**: external `curl` calls replaced with `std.http.Client` (public IP + middle-proxy metadata). - **Config control**: added `force_media_middle_proxy` (default `true`) for explicit media routing control. - **Stability guardrail**: startup warning added when running on software AES backend. - **Regression handling**: aggressive relay batching that harmed connectivity/handshake fairness was excluded from the final release. **Important** - Default media-path behavior is preserved (`force_media_middle_proxy = true`). - No config migration is required. - For best CPU efficiency, build with hardware AES enabled (`-Dcpu=x86_64_v3` or `-Dcpu=native`). --- ### Bug Fixes * docs: remove active capacity tables from README ([#88](https://github.com/sleep3r/mtproto.zig/issues/88)) ([509fe78](https://github.com/sleep3r/mtproto.zig/commit/509fe78)) * **proxy:** harden relay security and reduce middleproxy memory ([#89](https://github.com/sleep3r/mtproto.zig/issues/89)) ([5b36c6d](https://github.com/sleep3r/mtproto.zig/commit/5b36c6dd5b1a3afb5fe76de090b8a1e3a6f6a241)) --- This PR is managed by Release Please.
Related Repositories
lightpanda-io/browser★ 36,859
Lightpanda: the headless browser designed for AI and automation
tigerbeetle/tigerbeetle★ 17,229
The financial transactions database designed for mission critical safety and performance.
nullclaw/nullclaw★ 8,131
Fastest, smallest, and fully autonomous AI assistant infrastructure written in Zig
zml/zml★ 4,195
Any model. Any hardware. Zero compromise. Built with @ziglang / @openxla / MLIR / @bazelbuild
dmtrKovalenko/odiff★ 3,280
A very fast SIMD-first image comparison library (with nodejs API)