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

docker-compose.yml 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. services:
  21. haproxy:
  22. image: haproxy:lts-alpine
  23. ports:
  24. - "443:443"
  25. - "80:80"
  26. volumes:
  27. - ./haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro,Z
  28. environment:
  29. DOMAIN: ${DOMAIN:-example.com}
  30. depends_on:
  31. - mtg
  32. - web
  33. restart: unless-stopped
  34. sysctls:
  35. - net.ipv4.ip_unprivileged_port_start=80
  36. mtg:
  37. image: nineseconds/mtg:2
  38. volumes:
  39. - ./mtg-config.toml:/config/config.toml:ro,Z
  40. expose:
  41. - "3128"
  42. restart: unless-stopped
  43. extra_hosts:
  44. - "host.containers.internal:host-gateway"
  45. web:
  46. image: caddy:alpine
  47. volumes:
  48. - ./Caddyfile:/etc/caddy/Caddyfile:ro,Z
  49. - caddy_data:/data
  50. - ./www:/srv:ro,Z
  51. expose:
  52. - "80"
  53. - "8443"
  54. environment:
  55. DOMAIN: ${DOMAIN:-example.com}
  56. restart: unless-stopped
  57. volumes:
  58. caddy_data: