v0.23.2
sleep3r/mtproto.zigv0.23.2May 11, 2026by sleep3r
Upgrading?
AI Summary
Patch release fixing MiddleProxy media path issues, specifically addressing DC203 fallback logic and decoupling the inbound client IP from the outbound Telegram egress IP.
Key Highlights
- Fixed DC203 fallback logic to close old sockets instead of retrying on half-closed connections
- New `[server].middle_proxy_nat_ip` config option for separate NAT configuration
- Decoupled inbound client IP from outbound egress IP for tunnel setups
New Features
- Separate MiddleProxy NAT IP configuration
Full Release Notes
## [0.23.2](https://github.com/sleep3r/mtproto.zig/compare/v0.23.1...v0.23.2) (2026-05-11) <details open> <summary>🇷🇺 Что нового (RU)</summary> ## Что решает этот релиз `v0.23.2` - patch-релиз для MiddleProxy media path, особенно для tunnel/NAT конфигураций. По issue [#249](https://github.com/sleep3r/mtproto.zig/issues/249) выяснились две отдельные проблемы: 1. В нашем fallback path был реальный баг для `dc_idx=203`: если MiddleProxy endpoint и direct fallback совпадали по адресу (`...:443`), proxy мог попробовать отправить direct DC nonce в уже отвергнутый/полузакрытый MP-сокет вместо нового подключения. 2. `[server].public_ip` использовался не только как входящий адрес для клиентских ссылок, но и как fallback для MiddleProxy NAT translation. В tunnel-сценариях это ломало media: клиенты подключались к одному IP, а исходящий трафик к Telegram уходил через другой egress IP. В результате у операторов появлялся неприятный выбор: поставить `public_ip` сервера и получить рабочую ссылку, но сломанный media path; или поставить egress IP туннеля и починить media, но ухудшить подключение клиентов. Теперь эти два понятия разделены. > [!IMPORTANT] > Если proxy ходит к Telegram через VPN/NAT egress, а клиенты подключаются к другому IP, используйте отдельный параметр: > > ```toml > [server] > public_ip = "IP_сервера_для_клиентов" > middle_proxy_nat_ip = "IP_egress_к_Telegram" > ``` > [!NOTE] > Обычные direct deployments без отдельного tunnel/NAT egress обычно не требуют изменений конфига. ## Что изменено ### Исправлен fallback после MiddleProxy handshake failure ([#255](https://github.com/sleep3r/mtproto.zig/pull/255)) - Fallback больше не пишет direct nonce в текущий MP-сокет после failed handshake. - Даже если direct fallback endpoint совпадает с текущим endpoint (важно для DC203), proxy закрывает старый upstream socket и открывает новое direct-подключение. - Добавлен regression test на случай, где `dc_idx=203` имеет одинаковый MP endpoint и direct fallback. ### `public_ip` больше не используется как MiddleProxy NAT IP ([#257](https://github.com/sleep3r/mtproto.zig/pull/257)) - `[server].public_ip` теперь трактуется как входящий адрес/domain для клиентских ссылок. - MiddleProxy NAT IP выбирается отдельно: - сначала `[server].middle_proxy_nat_ip`; - затем auto-detected AWG endpoint; - затем независимый public egress probe. - Добавлен отдельный модуль `middle_proxy_nat.zig` с тестами выбора NAT IP. - `mtbuddy config` теперь показывает `middle_proxy_nat_ip`, если он задан. - README и `config.toml.example` обновлены, чтобы явно разделить inbound client IP и outbound Telegram egress IP. ## Проверено - `zig build test --summary all` - CI `Test & Build` - CI `E2E Integration` - CI `Bench (No Soak)` </details> --- <details> <summary>🇬🇧 Release notes (EN)</summary> ## What this release addresses `v0.23.2` is a patch release for the MiddleProxy media path, especially for tunnel/NAT deployments. Issue [#249](https://github.com/sleep3r/mtproto.zig/issues/249) exposed two separate problems: 1. The direct fallback path had a real bug for `dc_idx=203`: when the MiddleProxy endpoint and direct fallback endpoint were the same (`...:443`), the proxy could send a direct DC nonce into an already rejected/half-closed MP socket instead of opening a fresh connection. 2. `[server].public_ip` was used both as the inbound address for client links and as a fallback source for MiddleProxy NAT translation. In tunnel setups, clients connect to one IP while Telegram sees a different outbound egress IP. This forced operators into a bad tradeoff: use the server IP and get working client links but broken media, or use the tunnel egress IP and restore media while making client connections worse. These two concepts are now separated. > [!IMPORTANT] > If proxy traffic reaches Telegram through a VPN/NAT egress while clients connect to a different IP, configure both values explicitly: > > ```toml > [server] > public_ip = "CLIENT_FACING_SERVER_IP" > middle_proxy_nat_ip = "TELEGRAM_EGRESS_IP" > ``` > [!NOTE] > Regular direct deployments without a separate tunnel/NAT egress usually do not need config changes. ## What changed ### Fixed fallback after MiddleProxy handshake failure ([#255](https://github.com/sleep3r/mtproto.zig/pull/255)) - Fallback no longer sends a direct nonce into the current MP socket after a failed handshake. - Even when the direct fallback endpoint is the same as the current endpoint (important for DC203), the proxy closes the old upstream socket and opens a fresh direct connection. - Added regression coverage for the DC203 same-endpoint fallback case. ### `public_ip` is no longer used as MiddleProxy NAT IP ([#257](https://github.com/sleep3r/mtproto.zig/pull/257)) - `[server].public_ip` is now treated as the inbound address/domain used in client links. - MiddleProxy NAT IP is selected separately: - explicit `[server].middle_proxy_nat_ip`; - auto-detected AWG endpoint; - independent public egress probe. - Added a dedicated `middle_proxy_nat.zig` module with NAT IP selection tests. - `mtbuddy config` now prints `middle_proxy_nat_ip` when configured. - README and `config.toml.example` now clearly separate inbound client IP from outbound Telegram egress IP. ## Verified - `zig build test --summary all` - CI `Test & Build` - CI `E2E Integration` - CI `Bench (No Soak)` </details> ## Changelog * fix: reconnect direct fallback after middleproxy handshake failure ([#255](https://github.com/sleep3r/mtproto.zig/pull/255)) ([9bd2e88](https://github.com/sleep3r/mtproto.zig/commit/9bd2e88fc8a99ccd53144a3bb6121acd6041f0b3)) * fix: decouple MiddleProxy NAT IP from public_ip ([#257](https://github.com/sleep3r/mtproto.zig/pull/257)) ([d247ab9](https://github.com/sleep3r/mtproto.zig/commit/d247ab9a41bb6429cd0d8243dc98a5bb0559bd19)) * chore(main): release 0.23.2 ([#256](https://github.com/sleep3r/mtproto.zig/pull/256))
Related Repositories
lightpanda-io/browser★ 36,855
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)