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
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

docker-compose.yml 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. # FIXME: :master until #480 lands in a tagged release; switch back to :2/:3 after release
  40. image: nineseconds/mtg:master
  41. volumes:
  42. - ./mtg-config.toml:/config/config.toml:ro,Z
  43. expose:
  44. - "3128"
  45. restart: unless-stopped
  46. extra_hosts:
  47. - "host.containers.internal:host-gateway"
  48. web:
  49. image: caddy:alpine
  50. volumes:
  51. - ./Caddyfile:/etc/caddy/Caddyfile:ro,Z
  52. - caddy_data:/data
  53. - ./www:/srv:ro,Z
  54. expose:
  55. - "80"
  56. - "8443"
  57. environment:
  58. <<: *domain-env
  59. restart: unless-stopped
  60. volumes:
  61. caddy_data: