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 символов.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. # SNI-routing deployment: HAProxy (443) -> mtg + real web backend
  2. #
  3. # This setup puts an SNI-aware TCP router in front of mtg so that:
  4. # - Telegram clients (FakeTLS with the correct SNI) are routed to mtg
  5. # - All other TLS traffic (including DPI probes) reaches the real web
  6. # server, which responds with a genuine certificate
  7. #
  8. # The result: active probes see a real website; passive DPI sees matching
  9. # SNI/IP because the domain resolves to this server's IP.
  10. #
  11. # Quick start:
  12. # 1. Set DOMAIN in a .env file next to this one (or export it)
  13. # 2. mtg generate-secret YOUR_DOMAIN -> paste into mtg-config.toml
  14. # 3. docker compose up -d
  15. #
  16. # DOMAIN is forwarded to both Caddy (TLS cert) and HAProxy (SNI ACL),
  17. # so the SNI/cert/secret all line up from a single source.
  18. #
  19. # See BEST_PRACTICES.md and the project wiki for background.
  20. x-domain-env: &domain-env
  21. DOMAIN: ${DOMAIN:-example.com}
  22. services:
  23. haproxy:
  24. image: haproxy:lts-alpine
  25. ports:
  26. - "443:443"
  27. - "80:80"
  28. volumes:
  29. - ./haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro,Z
  30. environment:
  31. <<: *domain-env
  32. depends_on:
  33. - mtg
  34. - web
  35. restart: unless-stopped
  36. sysctls:
  37. - net.ipv4.ip_unprivileged_port_start=80
  38. mtg:
  39. image: nineseconds/mtg:2
  40. volumes:
  41. - ./mtg-config.toml:/config/config.toml:ro,Z
  42. expose:
  43. - "3128"
  44. restart: unless-stopped
  45. extra_hosts:
  46. - "host.containers.internal:host-gateway"
  47. web:
  48. image: caddy:alpine
  49. volumes:
  50. - ./Caddyfile:/etc/caddy/Caddyfile:ro,Z
  51. - caddy_data:/data
  52. - ./www:/srv:ro,Z
  53. expose:
  54. - "80"
  55. - "8443"
  56. environment:
  57. <<: *domain-env
  58. restart: unless-stopped
  59. volumes:
  60. caddy_data: