github sleep3r/mtproto.zig v0.7.0

latest releases: v1.14.0, v1.13.0, v1.12.0...
4 months ago

0.7.0 (2026-04-05)

Release Notes: AmneziaWG Tunnel Support

🇬🇧 English

AmneziaWG Tunnel — deploy MTProto proxy in blocked regions

Problem: In countries like Russia, ТСПУ (TSPU) blocks direct TCP connections to Telegram data centers. A proxy on a foreign server still works, but suffers from cross-border throttling and active DPI probing.

Solution: Run the proxy on a local VPS (same country as the user) and tunnel only the Telegram traffic through an AmneziaWG VPN inside an isolated Linux network namespace.

Client ──→ VPS:443 ──→ [iptables DNAT] ──→ 10.200.200.2:443
              (host)                            (tg_proxy_ns)
                                                     │
                                                mtproto-proxy
                                                     │
                                               awg0 (tunnel)
                                                     │
                                             Telegram DC servers

Why it's better than a regular foreign proxy

  • Lower latency: client → local VPS is ~1 ms instead of ~50-80 ms to a foreign server
  • No cross-border throttling: DPI sees a local HTTPS connection, not international Telegram traffic
  • AmneziaWG is undetectable: junk fields (Jc, S1, H1...) break all known WireGuard signatures
  • Host stays safe: the tunnel runs inside a network namespace — SSH and other services are completely unaffected

One-command deploy

# New server (full setup)
make deploy-tunnel SERVER=<ip> AWG_CONF=awg.conf PASSWORD=<pass>

# Existing installation
make deploy-tunnel-only SERVER=<ip> AWG_CONF=awg.conf

The script installs AmneziaWG, creates the namespace, sets up DNAT + policy routing, patches the systemd service, switches to direct mode, validates connectivity to all 5 Telegram DCs, and prints the ready-to-use tg:// link.

New files

  • deploy/setup_tunnel.sh — automated tunnel setup script

New Makefile targets

  • make deploy-tunnel — full migration + tunnel
  • make deploy-tunnel-only — add tunnel to existing proxy

🇷🇺 Русский

Туннель AmneziaWG — деплой MTProto прокси в заблокированных регионах

Проблема: В России ТСПУ блокирует прямые TCP-подключения к дата-центрам Telegram. Прокси на зарубежном сервере работает, но страдает от трансграничного троттлинга и активного зондирования DPI.

Решение: Запускаем прокси на локальном VPS (в той же стране, что и пользователь), а трафик до Telegram пускаем через AmneziaWG VPN внутри изолированного Linux network namespace.

Клиент ──→ VPS:443 ──→ [iptables DNAT] ──→ 10.200.200.2:443
              (хост)                            (tg_proxy_ns)
                                                     │
                                                mtproto-proxy
                                                     │
                                               awg0 (туннель)
                                                     │
                                            Серверы Telegram DC

Почему это лучше обычного прокси за границей

  • Минимальная задержка: клиент → локальный VPS = ~1 мс вместо ~50-80 мс до зарубежного сервера
  • Нет трансграничного троттлинга: ТСПУ видит обычный HTTPS к местному IP, а не международный трафик Telegram
  • AmneziaWG не детектируется: джанк-параметры (Jc, S1, H1...) ломают все известные WireGuard-сигнатуры ТСПУ
  • Хост в безопасности: туннель работает внутри network namespace — SSH и остальные сервисы никак не затрагиваются

Деплой одной командой

# Новый сервер (полная установка)
make deploy-tunnel SERVER=<ip> AWG_CONF=awg.conf PASSWORD=<pass>

# Добавить туннель к существующей установке
make deploy-tunnel-only SERVER=<ip> AWG_CONF=awg.conf

Скрипт устанавливает AmneziaWG, создаёт namespace, настраивает DNAT + policy routing, патчит systemd-сервис, переключает на direct mode, проверяет доступность всех 5 Telegram DC и выводит готовую tg:// ссылку.

Новые файлы

  • deploy/setup_tunnel.sh — скрипт автоматической настройки туннеля

Новые Makefile-таргеты

  • make deploy-tunnel — полная миграция + туннель
  • make deploy-tunnel-only — добавить туннель к существующему прокси

Don't miss a new mtproto.zig release

NewReleases is sending notifications on new releases.