v1.3.0

sleep3r/mtproto.zigv1.3.0Jun 9, 2026by sleep3r

Upgrading?

AI Summary

Refactors tunnel/egress modules and adds VPN-link egress support to the interactive menu.

Key Highlights

  • VPN-link egress (sing-box/TUN) added to interactive setup menu
  • Refactored code into `sharelink`, `tunnel_wg`, and `tunnel_singbox` modules
  • Improved code organization without behavior changes
  • Support for VLESS-Reality in interactive mode

New Features

  • Interactive VPN-link egress setup
  • Module refactoring (sharelink, wg, singbox)
  • Improved installer UX

Full Release Notes

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

## Что добавляет этот релиз

`v1.3.0` — релиз про **доводку egress-провайдера** из [v1.2.0](https://github.com/sleep3r/mtproto.zig/releases/tag/v1.2.0) и наведение порядка в коде туннелей.

> [!NOTE]
> Поведение не меняется — обновление безопасно. Новая возможность (egress в интерактиве) включается явно, рефактор внутренний.

## Egress из VPN-ссылки теперь в интерактивном меню

В v1.2.0 провайдер был доступен **только как CLI-команда** (`mtbuddy setup egress <ссылка>`), а интерактивный «Setup tunnel» по-прежнему предлагал лишь AmneziaWG. Теперь при настройке туннеля сперва спрашивается **тип апстрима**:

- **AmneziaWG-конфиг** — как раньше (файл `.conf` / `vpn://`);
- **VPN-ссылка** — `vless:// vmess:// trojan:// ss://` → sing-box TUN-туннель; `wireguard://` → нативный kernel-WG-туннель.

Вторая ветка просит ссылку (несколько через пробел/перенос/запятую → failover-пул) и поднимает ровно тот же туннель, что и CLI. (У мастера установки и `config doctor` отдельного выбора апстрима нет — этот чузер был единственным местом, где торчал только Amnezia.)

## Рефактор: `egress`/`tunnel` распилены на 4 модуля

`egress.zig` был протухшим именем — он начинался как SOCKS-мост, потом был развёрнут на sing-box TUN-туннель — и дублировал `tunnel.zig` (оба дают `type=tunnel`). Перерезали по ответственности, **без изменения поведения**:

| Файл | Ответственность | Строк |
|---|---|---|
| `sharelink.zig` | парсинг любой VPN-ссылки → структура; чистый, только std | 426 |
| `tunnel.zig` | оркестрация туннеля: интерактив, выбор интерфейса пула, статус/удаление | 638 (было 2145) |
| `tunnel_wg.zig` | kernel-бэкенд AmneziaWG/WireGuard: подъём + управление WG-пулом, failover-скрипт + юниты | 1491 |
| `tunnel_singbox.zig` | sing-box TUN-бэкенд + команда `setup egress` (бывший egress.zig минус парсеры) | 491 |

Граф импортов — DAG (`tunnel` и `tunnel_singbox` → `tunnel_wg`; `tunnel_singbox` и `tunnel_wg` → `sharelink`; `sharelink` → только std). Суммарный объём кода не вырос (≈3046, чистый перенос). Тесты переехали вместе с кодом.

## Проверено

- `zig build test` (190 тестов) + кросс-сборка `x86_64-linux` + `aarch64-linux` ReleaseFast + `zig fmt` — зелёные.
- **installer-e2e на 5 ОС** (debian 11/12, ubuntu 20.04/22.04/24.04): установка + failover туннель-пула + чистое удаление — на перенесённом WG-бэкенде.
- **`setup egress <vless-reality>`**: `sbx0` поднимается, трафик уходит через сервер — на новых `tunnel_singbox` + `sharelink`.

</details>

---

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

## What this release adds

`v1.3.0` finishes the egress provider from [v1.2.0](https://github.com/sleep3r/mtproto.zig/releases/tag/v1.2.0) and tidies up the tunnel code.

> [!NOTE]
> Behavior is unchanged — upgrading is safe. The new capability (egress in the interactive menu) is opt-in; the refactor is internal.

## VPN-link egress is now in the interactive menu

In v1.2.0 the provider was reachable **only via the CLI** (`mtbuddy setup egress <link>`), while the interactive **Setup tunnel** still offered AmneziaWG only. Now setting up a tunnel asks the **upstream type** first:

- **AmneziaWG config** — the existing flow (`.conf` file / `vpn://`);
- **VPN share-link** — `vless:// vmess:// trojan:// ss://` → sing-box TUN tunnel; `wireguard://` → native kernel WG tunnel.

The second branch prompts for a link (several, space/newline/comma-separated → a failover pool) and brings up the exact same tunnel as the CLI. (The install wizard and `config doctor` have no separate upstream selector — this chooser was the only Amnezia-only spot.)

## Refactor: `egress`/`tunnel` split into four modules

`egress.zig` was a stale name — it began as the SOCKS bridge, then got pivoted to a sing-box TUN tunnel — and overlapped with `tunnel.zig` (both produce `type=tunnel`). Reorganized by responsibility, **no behavior change**:

| File | Responsibility | LOC |
|---|---|---|
| `sharelink.zig` | parse any VPN share-link → struct; pure, std-only | 426 |
| `tunnel.zig` | tunnel orchestration: interactive setup, pool selection, status/delete | 638 (was 2145) |
| `tunnel_wg.zig` | the AmneziaWG/WireGuard kernel backend: bring up + manage the WG pool, failover script + units | 1491 |
| `tunnel_singbox.zig` | the sing-box TUN backend + the `setup egress` command (renamed egress.zig, minus parsers) | 491 |

The import graph is a DAG (`tunnel` & `tunnel_singbox` → `tunnel_wg`; `tunnel_singbox` & `tunnel_wg` → `sharelink`; `sharelink` → std only). Total LOC unchanged (≈3046, a pure move). Tests moved with their code.

## Verified

- `zig build test` (190 tests) + cross-builds `x86_64-linux` + `aarch64-linux` ReleaseFast + `zig fmt` — green.
- **installer-e2e across 5 OSes** (debian 11/12, ubuntu 20.04/22.04/24.04): install + tunnel-pool failover + clean uninstall — exercising the moved WG backend.
- **`setup egress <vless-reality>`**: `sbx0` comes up and traffic egresses via the server — exercising the new `tunnel_singbox` + `sharelink`.

</details>

## Changelog

* feat(egress): interactive share-link egress + split egress/tunnel into sharelink/wg/singbox modules ([#326](https://github.com/sleep3r/mtproto.zig/pull/326))

Related Repositories