v1.13.0

sleep3r/mtproto.zigv1.13.0Aug 24, 2026by sleep3r

Upgrading?

AI Summary

Adds Hysteria2 as an egress option and fixes critical bugs found in live testing, specifically a 'dead proxy' issue with setup egress and a bug where the update process couldn't repair itself due to DNS issues.

Key Highlights

  • Adds Hysteria2 support as an egress protocol (hysteria2:// scheme).
  • Fixes a critical bug where setup egress created a non-functional proxy due to missing CAP_NET_ADMIN on hosts without prior tunnel setup.
  • Improves mtbuddy update to repair existing egress configurations in-place, even when DNS is broken.
  • Warns users that sing-box TUN egress is incompatible with MiddleProxy.
  • Removes egress config backups containing share links to prevent credential leakage.

New Features

  • Hysteria2 egress support.
  • Idempotent setup egress command.
  • In-place repair of egress via mtbuddy update.
  • MiddleProxy compatibility warnings.
  • Removal of egress config backups.

Full Release Notes

<details open>
<summary>🇷🇺 Что нового (RU)</summary>

## Коротко

`v1.13.0` добавляет **hysteria2 в качестве egress** ([#388](https://github.com/sleep3r/mtproto.zig/issues/388)) и чинит **пять багов, найденных прогоном на живых серверах** — ни один из них CI поймать не мог.

Худший жил с момента появления `setup egress`: **на хосте, который никогда не выполнял `setup tunnel`, эта команда давала полностью мёртвый прокси** — он принимал клиентов и не релеил ничего, при этом бодро печатая `✔ egress up`.

> ⚠️ **Если у вас настроен `setup egress` — обновитесь.** `mtbuddy update` теперь чинит всё сам, включая случай, когда старый egress убил хосту DNS и апдейт из-за этого не мог даже скачаться.

## hysteria2

```bash
sudo mtbuddy setup egress 'hysteria2://<auth>@host:40443/?sni=cover.example&obfs=salamander&obfs-password=<pw>'
```

`hysteria2://` и `hy2://` встают рядом с vless/vmess/trojan/ss. Прокси и маршрутизация не меняются — UDP живёт только на плече «хост → эндпоинт».

Две вещи стоит знать заранее:

- это **единственная схема с UDP на egress**, а провайдеры, блокирующие DC, часто душат и UDP — тогда туннель выглядит живым, но не везёт байты. Померьте канал до эндпоинта;
- Brutal (то, ради чего hysteria обычно и берут) из share-ссылки **не включается** — спецификация URI намеренно не несёт полосу, поэтому работает BBR, тот же алгоритм, что и на TCP-схемах.

Ссылки с `pinSHA256`, ECH, неизвестным obfs или port hopping отклоняются с внятным сообщением, а не молча деградируют.

## Что починено

- **`setup egress` давал мёртвый прокси** — не выдавался `CAP_NET_ADMIN`, без которого `SO_MARK` возвращает EPERM и падает каждый коннект к DC. Выдавал его только юнит AmneziaWG, так что работало лишь у тех, кто когда-то делал `setup tunnel`.
- **Фиксы TUN из v1.12.0 не доезжали до существующих хостов** — `mtbuddy update` теперь чинит egress на месте, причём **до** всего остального: сломанный egress убивает DNS всего хоста, и апдейт раньше умирал на резолве GitHub, не дойдя до починки.
- **MiddleProxy несовместим с sing-box-туннелем** — 3/3 отказа против 0/3 на `direct`. В прокси это не чинится (egress переписывает source-порт), но `setup egress` теперь предупреждает: связь работает, а ad-tag и медиа для не-Premium молча теряются.
- **`uninstall` оставлял на диске ваши share-ссылки** — удалялся `singbox-egress.json`, но не `.bak` рядом с ним, а это полный конфиг с паролями.
- **Пул из трёх и более ссылок не записывался в config.toml вообще** — значения длиннее 512 байт обрывали запись целиком, включая `[upstream] type = tunnel`.

Плюс: иконки у трёх пунктов главного меню, которые их не имели.

## Проверено

`zig build test` — 361, `zig build e2e` — 16/16, installer-E2E — все пять ног.

Впервые — прогон на двух живых серверах: hysteria2 сквозь всю цепочку (11.4 MB/s, проверено остановкой сервера), `workers = 2` под нагрузкой (780 соединений, 0 ошибок), `[access.user_max_ips]` под конкурентным допуском, failover пула (~20–50 с), дашборд, auto-recovery и полный цикл uninstall → установка → egress.

Не проверено: WEB-прокси (нужен реальный домен для ACME).

## Changelog

- feat(egress): hysteria2 share links + fix the CAP_NET_ADMIN that made `setup egress` a dead proxy ([#398](https://github.com/sleep3r/mtproto.zig/pull/398)) — closes [#388](https://github.com/sleep3r/mtproto.zig/issues/388)
- fix(egress): repair an existing sing-box egress from `mtbuddy update` ([#396](https://github.com/sleep3r/mtproto.zig/pull/396))
- fix(egress): run the update-time repair before any network work ([#399](https://github.com/sleep3r/mtproto.zig/pull/399))
- fix(egress): warn that a sing-box TUN egress breaks MiddleProxy ([#400](https://github.com/sleep3r/mtproto.zig/pull/400))
- fix(uninstall): remove the egress config backup — it holds the share links ([#401](https://github.com/sleep3r/mtproto.zig/pull/401))

</details>

---

<details>
<summary>🇬🇧 Release notes (EN)</summary>

## TL;DR

`v1.13.0` adds **hysteria2 as an egress** ([#388](https://github.com/sleep3r/mtproto.zig/issues/388)) and fixes **five bugs found by running the thing on live servers** — none of them reachable from CI.

The worst had been there since `setup egress` first shipped: **on a host that never ran `setup tunnel`, that command produced a completely dead proxy** — it accepted clients and relayed nothing, while cheerfully printing `✔ egress up`.

> ⚠️ **If you run `setup egress`, update.** `mtbuddy update` now repairs everything itself, including the case where an old egress had killed the host's DNS and the update could not even download because of it.

## hysteria2

```bash
sudo mtbuddy setup egress 'hysteria2://<auth>@host:40443/?sni=cover.example&obfs=salamander&obfs-password=<pw>'
```

`hysteria2://` and `hy2://` join vless/vmess/trojan/ss. The proxy and the routing are unchanged — the UDP exists only on the host→endpoint leg.

Two things worth knowing up front:

- this is the **only scheme whose egress leg is UDP**, and providers that block the DCs often police UDP too — the tunnel then looks healthy and moves no bytes. Measure the path to your endpoint;
- Brutal (the reason people usually reach for hysteria) **does not engage** from a share link — the URI spec deliberately carries no bandwidth, so it runs BBR, the same algorithm the TCP schemes already get.

Links with `pinSHA256`, ECH, an unknown obfs or port hopping are refused with a clear message rather than silently degraded.

## Fixed

- **`setup egress` produced a dead proxy** — no `CAP_NET_ADMIN`, without which `SO_MARK` returns EPERM and every DC connect fails. Only the AmneziaWG unit ever granted it, so it worked only for hosts that had run `setup tunnel` at some point.
- **The v1.12.0 TUN fixes never reached existing hosts** — `mtbuddy update` now repairs the egress in place, and does it **before** anything else: a broken egress kills the whole host's DNS, so the update used to die resolving GitHub and never got to the repair.
- **MiddleProxy is incompatible with a sing-box tunnel** — 3/3 fallbacks against 0/3 on `direct`. Not fixable in the proxy (the egress rewrites the source port), but `setup egress` now warns: connections still work while the ad-tag and non-Premium media are silently lost.
- **`uninstall` left your share links on disk** — it removed `singbox-egress.json` but not the `.bak` beside it, which is a full config, passwords included.
- **A pool of three or more links wrote nothing to config.toml** — values over 512 bytes aborted the whole write, `[upstream] type = tunnel` included.

Plus: icons on the three main-menu entries that were missing them.

## Verified

`zig build test` — 361, `zig build e2e` — 16/16, installer E2E — all five legs.

And, for the first time, a run on two live servers: hysteria2 through the whole chain (11.4 MB/s, falsified by stopping the far end), `workers = 2` under load (780 connections, 0 errors), `[access.user_max_ips]` under concurrent admission, pool failover (~20–50 s), the dashboard, auto-recovery, and the full uninstall → install → egress cycle.

Not covered: the WEB proxy (needs a real domain for ACME).

## Changelog

- feat(egress): hysteria2 share links + fix the CAP_NET_ADMIN that made `setup egress` a dead proxy ([#398](https://github.com/sleep3r/mtproto.zig/pull/398)) — closes [#388](https://github.com/sleep3r/mtproto.zig/issues/388)
- fix(egress): repair an existing sing-box egress from `mtbuddy update` ([#396](https://github.com/sleep3r/mtproto.zig/pull/396))
- fix(egress): run the update-time repair before any network work ([#399](https://github.com/sleep3r/mtproto.zig/pull/399))
- fix(egress): warn that a sing-box TUN egress breaks MiddleProxy ([#400](https://github.com/sleep3r/mtproto.zig/pull/400))
- fix(uninstall): remove the egress config backup — it holds the share links ([#401](https://github.com/sleep3r/mtproto.zig/pull/401))

</details>

Related Repositories