github sleep3r/mtproto.zig v0.24.0

latest releases: v1.13.0, v1.12.0, v1.11.0...
3 months ago
🇷🇺 Что нового (RU)

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

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-схему:

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

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

[server]
port = 8444
public_port = 443

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

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

[!TIP]
Для новых установок можно сразу передать --public-port:

sudo mtbuddy install --port 8444 --public-port 443 --domain wb.ru --yes

Что изменено

Постоянный public port для клиентских ссылок (#264, закрывает #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)

  • 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)

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

Installer e2e workflow (#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

🇬🇧 Release notes (EN)

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:

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:

[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:

sudo mtbuddy install --port 8444 --public-port 443 --domain wb.ru --yes

What changed

Persistent public port for client links (#264, closes #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)

  • 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)

  • 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)

  • 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

Changelog

Don't miss a new mtproto.zig release

NewReleases is sending notifications on new releases.