Expose Your MtProto Proxy to the Internet
You can use this project to expose your Telegram MtProto proxy and don't worry about portability and port forwarding. This project is using mtprotoproxy, written in Python.
The code has been tested on Windows 10, macOS, and most Linux operating systems with Python 3.5-3.12.
- To get a copy via git:
git clone https://github.com/Oct4Pie/MtProto-ngrok.git
The proxy may run smoother and faster when the cryptography module is installed.
- It can be installed from pypi via PIP:
pip3 install cryptography
main.py
downloads and runs ngrok- Ngrok requires an authentication token to route TCP traffic. You can sign up at here and then obtain your token from here.
- Set
AUTHTOKEN
inconfig.py
equal to your token.
# config.py
import os
import random
os.chdir(os.path.dirname(__file__))
PORT = 4443
USERS = {
"tg": open("secret", "r").read() if os.path.exists("secret") else "",
}
MODES = {
"classic": False,
"secure": True,
"tls": True,
}
TLS_DOMAIN = random.choice(
[
"www.ngrok.com",
]
)
AUTHTOKEN = "" # set to your ngrok's token
# AD_TAG = "" # set to your ad tag
- To run the proxy server and ngrok tunnel use:
cd MtProto-ngrok
python3 main.py
- The output url can be pasted in your Telegram app
$ python3 main.py
TLS:
in-app: tg://proxy?server=6.tcp.ngrok.io&port=19977&secret=eed22691fe775a6bfefd0bd56c63afd8257777772e6e67726f6b2e636f6d
external: https://t.me/proxy?server=6.tcp.ngrok.io&port=19977&secret=eed22691fe775a6bfefd0bd56c63afd8257777772e6e67726f6b2e636f6d
Secure:
in-app: tg://proxy?server=6.tcp.ngrok.io&port=19977&secret=ddd22691fe775a6bfefd0bd56c63afd825
external: https://t.me/proxy?server=6.tcp.ngrok.io&port=19977&secret=ddd22691fe775a6bfefd0bd56c63afd825
host:port -> 6.tcp.ngrok.io:19977
secret -> d22691fe775a6bfefd0bd56c63afd825
RPReplay_Final1719295156.1.mp4
You can access it here: https://replit.com/@oct4pie/MtProto-ngrok#main.py
- Click the green "Run" button at the top of the editor page to execute your code.
- Sign up or log in to Replit.
- On the Replit dashboard, click the "Create" button.
- Choose the "Python" template to set up a new Python environment.
- Give your Repl a name and optionally provide a description.
- You can directly import the GitHub repository by clicking "Import from GitHub" and providing the repository URL: https://github.com/Oct4Pie/MtProto-ngrok
- To manage packages and dependencies, navigate to the "Packages" tab on the left sidebar and install necessary packages.
- Click the green "Run" button at the top of the editor page to execute your code.
- If your project involves a web application, deploy it directly from Replit using the "Share" menu.
- Refer to the @MTProxybot Telegram bot to obtain a tag
- Set
AD_TAG
inconfig.py
equal to your tag
This project is licensed under the MIT License See LICENSE file for more details