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.

mtg-config.toml 1021B

12345678910111213141516171819202122232425262728
  1. # Minimal mtg configuration for the SNI-router setup.
  2. #
  3. # 1. Generate a secret: mtg generate-secret --hex <your.domain>
  4. # 2. Paste it into the `secret` field below.
  5. # 3. Set DOMAIN=<your.domain> in .env (HAProxy + Caddy pick it up).
  6. secret = "PASTE_YOUR_SECRET_HERE"
  7. bind-to = "[::]:3128"
  8. # HAProxy in front sends PROXY protocol v2 headers so mtg can see the
  9. # real client IP. Keep this in sync with haproxy.cfg (`send-proxy-v2`).
  10. proxy-protocol-listener = true
  11. # Fronting target: point mtg at the Caddy container directly so its
  12. # fallback dial (for non-Telegram TLS) bypasses HAProxy and doesn't
  13. # loop back here. Without this, mtg resolves the secret's hostname
  14. # via DNS, which in this setup resolves to this server -> HAProxy ->
  15. # mtg again. See README's "Fronting loop" section for the long form.
  16. # Requires mtg >= 2.4 (#480 added hostname acceptance for the target).
  17. [domain-fronting]
  18. host = "web"
  19. port = 8443
  20. proxy-protocol = true
  21. [defense.anti-replay]
  22. enabled = true
  23. max-size = "1mib"
  24. error-rate = 0.001