v0.24.0

sleep3r/mtproto.zigv0.24.0May 14, 2026by sleep3r

Upgrading?

AI Summary

Adds a persistent `public_port` configuration option to support deployments behind reverse proxies (HAProxy/Nginx) where the public port differs from the internal listen port.

Key Highlights

  • New optional `[server].public_port` config field
  • Updated `mtbuddy links`, install summary, and dashboard to use public port
  • Added `--public-port` flag to `mtbuddy install` command

New Features

  • Persistent public port override for client links

Full Release Notes

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

## Что решает этот релиз

`v0.24.0` - небольшой feature-релиз для операторов, которые запускают `mtproto.zig` за HAProxy, Nginx stream или другим reverse proxy / TCP load balancer.

Раньше в конфиге уже был `[server].public_ip`, чтобы подменить адрес в клиентских ссылках. Но порт в `tg://` / `t.me` ссылках всё равно почти везде брался из `[server].port` - то есть из реального listen-port прокси.

Это ломало типичную backend-схему:

```text
Telegram client -> public.example.com:443 -> HAProxy -> mtproto-proxy:8444
```

Прокси слушает `8444`, но клиенты должны подключаться к публичному `443`. До этого можно было разово выполнить `mtbuddy links --port 443`, но install summary и dashboard продолжали показывать backend-port. В `v0.24.0` для этого появился постоянный конфиговый параметр:

```toml
[server]
port = 8444
public_port = 443
```

После этого все генерируемые клиентские ссылки используют `port=443`, а сам proxy runtime продолжает слушать `8444`.

> [!NOTE]
> Существующие конфиги менять не нужно. Если `public_port` не задан, поведение остаётся прежним: ссылки используют `[server].port`.

> [!TIP]
> Для новых установок можно сразу передать `--public-port`:
>
> ```bash
> sudo mtbuddy install --port 8444 --public-port 443 --domain wb.ru --yes
> ```

## Что изменено

### Постоянный public port для клиентских ссылок ([#264](https://github.com/sleep3r/mtproto.zig/pull/264), закрывает [#260](https://github.com/sleep3r/mtproto.zig/issues/260))

- Добавлен опциональный `[server].public_port`.
- Runtime config parser теперь читает этот параметр, но он не влияет на listen socket.
- Новый helper `publicLinkPort()` возвращает `public_port`, если он задан, иначе обычный `[server].port`.
- Старые конфиги и deployments без reverse proxy сохраняют прежнее поведение.

### mtbuddy links, install summary и dashboard используют один и тот же fallback ([#264](https://github.com/sleep3r/mtproto.zig/pull/264))

- `mtbuddy links` теперь выбирает порт так:
  1. `--port <port>` из CLI;
  2. `[server].public_port`;
  3. `[server].port`.
- Финальный экран `mtbuddy install` печатает ссылки с `public_port`, если он задан.
- Dashboard API генерирует `tg://` и `https://t.me/proxy` links с публичным портом.
- Если публичный порт отличается от listen-port, install summary и startup banner показывают его отдельно как `Public Port`.

### Установка и документация ([#264](https://github.com/sleep3r/mtproto.zig/pull/264))

- Добавлен `mtbuddy install --public-port <port>`.
- `mtbuddy config print-effective` теперь показывает `public_port`, если он задан.
- `config.toml.example`, README и README.ru описывают HAProxy/Nginx сценарий.

### Installer e2e workflow ([#263](https://github.com/sleep3r/mtproto.zig/pull/263))

- В репозиторий добавлен installer e2e workflow, чтобы проверять clean install путь отдельным CI-сценарием.
- Это не меняет runtime-поведение, но помогает ловить regressions в `mtbuddy install` раньше.

## Проверено

- `zig build test`
- `zig build -Dtarget=x86_64-linux-musl`
- `python3 -m py_compile src/ctl/dashboard_assets/server.py`

</details>

---

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

## What this release addresses

`v0.24.0` is a small feature release for operators running `mtproto.zig` behind HAProxy, Nginx stream, or another reverse proxy / TCP load balancer.

The config already had `[server].public_ip` for overriding the address used in client links. But the port in generated `tg://` / `t.me` links was still taken from `[server].port` in most places - the actual proxy listen port.

That broke a common backend layout:

```text
Telegram client -> public.example.com:443 -> HAProxy -> mtproto-proxy:8444
```

The proxy listens on `8444`, but clients must connect to public port `443`. Previously, operators could work around this with a one-off `mtbuddy links --port 443`, while the install summary and dashboard still showed the backend port. `v0.24.0` adds a persistent config option for this:

```toml
[server]
port = 8444
public_port = 443
```

Generated client links now use `port=443`, while the proxy runtime still listens on `8444`.

> [!NOTE]
> Existing configs do not need changes. If `public_port` is not set, behavior is unchanged: links use `[server].port`.

> [!TIP]
> New installs can set it directly:
>
> ```bash
> sudo mtbuddy install --port 8444 --public-port 443 --domain wb.ru --yes
> ```

## What changed

### Persistent public port for client links ([#264](https://github.com/sleep3r/mtproto.zig/pull/264), closes [#260](https://github.com/sleep3r/mtproto.zig/issues/260))

- Added optional `[server].public_port`.
- The runtime config parser reads the setting, but it does not affect the listen socket.
- A new `publicLinkPort()` helper returns `public_port` when set, otherwise `[server].port`.
- Existing configs and deployments without a reverse proxy keep the previous behavior.

### mtbuddy links, install summary, and dashboard share the same fallback ([#264](https://github.com/sleep3r/mtproto.zig/pull/264))

- `mtbuddy links` now chooses the link port in this order:
  1. CLI `--port <port>`;
  2. `[server].public_port`;
  3. `[server].port`.
- The final `mtbuddy install` screen prints links with `public_port` when configured.
- The dashboard API generates `tg://` and `https://t.me/proxy` links with the public port.
- When the public port differs from the listen port, install summary and startup banner show it separately as `Public Port`.

### Install and documentation ([#264](https://github.com/sleep3r/mtproto.zig/pull/264))

- Added `mtbuddy install --public-port <port>`.
- `mtbuddy config print-effective` now shows `public_port` when configured.
- `config.toml.example`, README, and README.ru document the HAProxy/Nginx scenario.

### Installer e2e workflow ([#263](https://github.com/sleep3r/mtproto.zig/pull/263))

- Added an installer e2e workflow to validate the clean install path as a dedicated CI scenario.
- This does not change runtime behavior, but it helps catch `mtbuddy install` regressions earlier.

## Verified

- `zig build test`
- `zig build -Dtarget=x86_64-linux-musl`
- `python3 -m py_compile src/ctl/dashboard_assets/server.py`

</details>

## Changelog

* feat: add public port override for proxy links ([#264](https://github.com/sleep3r/mtproto.zig/pull/264)) ([630de8d](https://github.com/sleep3r/mtproto.zig/commit/630de8d380356c0da5784beccac2492c64e5dc02))
* test: add installer e2e workflow ([#263](https://github.com/sleep3r/mtproto.zig/pull/263)) ([640b898](https://github.com/sleep3r/mtproto.zig/commit/640b898095a5bb19cc91fce35117f83779357fab))
* chore(main): release 0.24.0 ([#265](https://github.com/sleep3r/mtproto.zig/pull/265)) ([8f5945a](https://github.com/sleep3r/mtproto.zig/commit/8f5945a5ed4cd2794b62ac0b883e29b7c7456e85))

Related Repositories