A production-grade, containerized implementation of the official Telegram MTProto Proxy. This repository is architected for maximum evasion against Deep Packet Inspection (DPI) firewalls using ee prefixed Fake-TLS secrets, while natively supporting promoted channels for monetization or brand visibility.
- DPI Evasion (Fake-TLS): Prioritizes port 443 and utilizes high-reputation cover domains (default:
cloudflare.com) to make traffic indistinguishable from standard HTTPS. - Least Privilege Execution: Container capabilities are heavily restricted.
ALLcapabilities are dropped, selectively adding onlyNET_BIND_SERVICE,CHOWN,SETUID,SETGID, andDAC_OVERRIDEto minimize the blast radius of potential vulnerabilities. - High Concurrency: OS-level file descriptor limits (
ulimits) are tuned to1048576(soft/hard) to support massive concurrent user connections without socket starvation. - Automated Cryptography: Dynamically generates cryptographically secure 16-byte hex secrets natively mapped to the SNI payload.
- A Linux-based server (Ubuntu/Debian recommended) with a public IP address.
- Docker and Docker Compose installed.
- Port
443open on your server's firewall.
1. Clone the repository
git clone [https://github.com/visatk/mtg.git](https://github.com/visatk/mtg.git)
cd mtg
2. Make the setup script executable
chmod +x setup_mtproxy.sh
3. Register your Proxy & Get an Ad Tag To monetize or promote a channel, you must register your proxy with Telegram:
- Open Telegram and start a chat with @MTProxybot.
- Send
/newproxyand provide your server's public IP and port (e.g.,1.2.3.4:443). - Generate a temporary secret or use a placeholder to complete registration.
- Send
/myproxies, select your proxy, and choose "Set Ad". - Provide your channel username (e.g.,
@MyChannel). - The bot will reply with a 32-character hex Ad Tag. Save this.
4. Deploy the Infrastructure
./setup_mtproxy.sh
When prompted, paste the 32-character Ad Tag obtained from @MTProxybot.
The script will automatically generate your AppSec-compliant Fake-TLS secret, deploy the Docker container, and output your final shareable t.me connection link.
Modify docker-compose.yml to scale workers based on your CPU cores:
environment:
- WORKERS=4 # Scale this to match your host's logical CPU cores
To change the Fake-TLS cover domain (if cloudflare.com is blocked in your target region), edit setup_mtproxy.sh:
COVER_DOMAIN="google.com" # Ensure this is a TLS 1.3 enabled domain
Logs: View real-time connection and worker logs:
docker logs -f mtproxy
Container Restart:
docker-compose restart
Distributed under the MIT License. See LICENSE for more information.