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
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

mtg-config.toml.example 1.4KB

1234567891011121314151617181920212223242526272829303132333435
  1. # Minimal mtg configuration template for the SNI-router setup.
  2. #
  3. # This is the tracked template; `docker compose` mounts `mtg-config.toml`
  4. # (gitignored), so render or copy this file before `docker compose up -d`:
  5. #
  6. # 1. Set DOMAIN=<your.domain> in .env (HAProxy + Caddy pick it up).
  7. # 2. Generate the secret: mtg generate-secret --hex <your.domain>
  8. # 3. Produce mtg-config.toml — pick one:
  9. # export MTG_SECRET=... # paste the hex secret
  10. # envsubst < mtg-config.toml.example > mtg-config.toml
  11. # or just copy and hand-edit `${MTG_SECRET}`:
  12. # cp mtg-config.toml.example mtg-config.toml && $EDITOR mtg-config.toml
  13. secret = "${MTG_SECRET}"
  14. bind-to = "[::]:3128"
  15. # HAProxy in front sends PROXY protocol v2 headers so mtg can see the
  16. # real client IP. Keep this in sync with haproxy.cfg (`send-proxy-v2`).
  17. proxy-protocol-listener = true
  18. # Fronting target: point mtg at the Caddy container directly so its
  19. # fallback dial (for non-Telegram TLS) bypasses HAProxy and doesn't
  20. # loop back here. Without this, mtg resolves the secret's hostname
  21. # via DNS, which in this setup resolves to this server -> HAProxy ->
  22. # mtg again. See README's "Fronting loop" section for the long form.
  23. # Requires mtg >= 2.4 (#480 added hostname acceptance for the target).
  24. [domain-fronting]
  25. host = "web"
  26. port = 8443
  27. proxy-protocol = true
  28. [defense.anti-replay]
  29. enabled = true
  30. max-size = "1mib"
  31. error-rate = 0.001