Highly-opinionated (ex-bullshit-free) MTPROTO proxy for Telegram. If you use v1.0 or upgrade broke you proxy, please read the chapter Version 2
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
dolonet fd3670ac9f
Merge pull request #3 from dolonet/fix/benchmark-lint-and-race
1 month ago
.github/workflows Run release build 1 month ago
antireplay Update to the latest golangci-lint 2 months ago
benchmarks Fix CI: benchmark lint exclusions and data race in doppel test 1 month ago
essentials Add validation of telegram connectivity 1 month ago
events fix: prevent index out of range panic on 32-bit platforms 1 month ago
internal Add multi-secret support and per-user stats API 1 month ago
ipblocklist Rewrite to WaitGroup.Go 2 months ago
logger More idioms related to go 1.26 2 months ago
mtglib Merge remote-tracking branch 'upstream/master' 1 month ago
network fix: ensure network.Dial and MakeHTTPClient use socks5 proxy 1 month ago
stats More idioms related to go 1.26 2 months ago
.codecov.yml Add prefix for codecov 5 years ago
.dockerignore Update ignores 5 years ago
.gitattributes Add PGO 1 month ago
.gitignore Update fork build config and add upstream sync 1 month ago
.golangci.toml Fix golangci config: use v2 linters.exclusions.rules syntax 1 month ago
.goreleaser.yml Update fork build config and add upstream sync 1 month ago
.mise.toml Fix build with profiling 1 month ago
BEST_PRACTICES.md Update docs 1 month ago
Dockerfile Allow using directory bind mounts for a docker container 1 month ago
LICENSE Initial commit 8 years ago
README.md Rewrite README: fork features first, bilingual, drop legacy sections 1 month ago
SECURITY.md Create SECURITY.md 5 years ago
buildinfo.go Update dependencies 3 years ago
escapecheck Merge remote-tracking branch 'upstream/master' 1 month ago
example.config.toml Add multi-secret support and per-user stats API 1 month ago
go.mod Update depndencies 1 month ago
go.sum Update depndencies 1 month ago
main.go Add PGO 1 month ago
mise.lock Update linter 1 month ago
run_profile.go Refactoring 1 month ago
run_profile_tag_prof.go Fix build with profiling 1 month ago

README.md

mtg-multi

Fork of 9seconds/mtg with multi-secret support and per-user stats.

English | Русский


What’s different

Multiple secrets. Upstream mtg allows only one secret per instance. mtg-multi lets you define named secrets in the config — one per user. All secrets must share the same hostname.

[secrets]
alice = "ee367a189aee18fa31c190054efd4a8e9573746f726167652e676f6f676c65617069732e636f6d"
bob   = "ee0123456789abcdef0123456789abcd9573746f726167652e676f6f676c65617069732e636f6d"

Stats API. A lightweight HTTP endpoint that shows live per-user traffic.

api-bind-to = "127.0.0.1:9090"
GET /stats
{
  "started_at": "2026-03-29T10:30:00Z",
  "uptime_seconds": 3600,
  "total_connections": 15,
  "users": {
    "alice": {
      "connections": 8,
      "bytes_in": 1048576,
      "bytes_out": 2097152,
      "last_seen": "2026-03-29T11:25:30Z"
    }
  }
}

Public IP override. Useful when auto-detection via ifconfig.co is unavailable.

public-ipv4 = "1.2.3.4"
public-ipv6 = "2001:db8::1"

Everything else — domain fronting, doppelganger, proxy chaining, blocklists, metrics — works exactly as in upstream. See the upstream README for details.

Quick start

Download a binary from Releases or build from source:

git clone https://github.com/dolonet/mtg-multi.git
cd mtg-multi
mise install && mise tasks run build

Generate secrets:

mtg-multi generate-secret --hex storage.googleapis.com

Minimal config:

bind-to = "0.0.0.0:443"

[secrets]
alice = "ee..."
bob   = "ee..."

api-bind-to = "127.0.0.1:9090"

Run:

mtg-multi run /etc/mtg/config.toml

See example.config.toml for all available options.


Чем отличается

Несколько секретов. В оригинальном mtg — один секрет на инстанс. mtg-multi позволяет задать именованные секреты в конфиге, по одному на пользователя. Все секреты должны использовать один и тот же hostname.

[secrets]
alice = "ee367a189aee18fa31c190054efd4a8e9573746f726167652e676f6f676c65617069732e636f6d"
bob   = "ee0123456789abcdef0123456789abcd9573746f726167652e676f6f676c65617069732e636f6d"

Stats API. HTTP-эндпоинт с live-статистикой трафика по пользователям.

api-bind-to = "127.0.0.1:9090"
GET /stats
{
  "started_at": "2026-03-29T10:30:00Z",
  "uptime_seconds": 3600,
  "total_connections": 15,
  "users": {
    "alice": {
      "connections": 8,
      "bytes_in": 1048576,
      "bytes_out": 2097152,
      "last_seen": "2026-03-29T11:25:30Z"
    }
  }
}

Ручное указание публичного IP. Для случаев, когда ifconfig.co недоступен с сервера.

public-ipv4 = "1.2.3.4"
public-ipv6 = "2001:db8::1"

Всё остальное — domain fronting, doppelganger, цепочки прокси, блоклисты, метрики — работает как в оригинале. Подробности в README upstream.

Быстрый старт

Скачайте бинарник из Releases или соберите из исходников:

git clone https://github.com/dolonet/mtg-multi.git
cd mtg-multi
mise install && mise tasks run build

Генерация секрета:

mtg-multi generate-secret --hex storage.googleapis.com

Минимальный конфиг:

bind-to = "0.0.0.0:443"

[secrets]
alice = "ee..."
bob   = "ee..."

api-bind-to = "127.0.0.1:9090"

Запуск:

mtg-multi run /etc/mtg/config.toml

Все доступные опции — в example.config.toml.