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 2.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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 -> render mtg-config.toml:
  14. # export MTG_SECRET=... # paste the hex secret
  15. # envsubst < mtg-config.toml.example > mtg-config.toml
  16. # (the rendered file is gitignored). See README.md for the cp+edit variant.
  17. # 3. docker compose up -d
  18. #
  19. # DOMAIN is forwarded to both Caddy (TLS cert) and HAProxy (SNI ACL),
  20. # so the SNI/cert/secret all line up from a single source.
  21. #
  22. # See BEST_PRACTICES.md and the project wiki for background.
  23. x-domain-env: &domain-env
  24. DOMAIN: ${DOMAIN:-example.com}
  25. services:
  26. haproxy:
  27. image: haproxy:lts-alpine
  28. ports:
  29. - "443:443"
  30. - "80:80"
  31. volumes:
  32. - ./haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro,Z
  33. environment:
  34. <<: *domain-env
  35. depends_on:
  36. - mtg
  37. - web
  38. restart: unless-stopped
  39. sysctls:
  40. - net.ipv4.ip_unprivileged_port_start=80
  41. mtg:
  42. # FIXME: :master until #480 lands in a tagged release; switch back to :2/:3 after release
  43. image: nineseconds/mtg:master
  44. volumes:
  45. - ./mtg-config.toml:/config/config.toml:ro,Z
  46. expose:
  47. - "3128"
  48. restart: unless-stopped
  49. extra_hosts:
  50. - "host.containers.internal:host-gateway"
  51. web:
  52. image: caddy:alpine
  53. volumes:
  54. - ./Caddyfile:/etc/caddy/Caddyfile:ro,Z
  55. - caddy_data:/data
  56. - ./www:/srv:ro,Z
  57. expose:
  58. - "80"
  59. - "8443"
  60. environment:
  61. <<: *domain-env
  62. restart: unless-stopped
  63. volumes:
  64. caddy_data: