Skip to content

toanalien/mtprotoproxy

 
 

Repository files navigation

Async MTProto Proxy

Fast and simple to setup MTProto proxy written in Python.

Starting Up

  1. git clone -b master https://github.com/toanalien/mtprotoproxy
  2. (optional, recommended) edit config.py, set PORT, USERS and AD_TAG
  3. curl -o- https://get.docker.com | bash
  4. docker compose up -d (or just python3 mtprotoproxy.py if you don't like Docker)
  5. (optional, get a link to share the proxy) docker compose logs

User Management

The proxy comes with a command-line tool to easily manage users:

  1. Add a new user with auto-generated secret:
./manage_users.py add username
# Output: User username added successfully with secret: 1234567890abcdef1234567890abcdef
  1. Add a user with specific secret:
./manage_users.py add username 00000000000000000000000000000001
  1. List all users:
./manage_users.py list
  1. Remove a user:
./manage_users.py remove username
  1. For Docker installation, use the following command formats:
# Add a user
docker exec -u root -it mtprotoproxy /usr/bin/python3 manage_users.py add username

# List all users
docker exec -u root -it mtprotoproxy /usr/bin/python3 manage_users.py list

# Remove a user
docker exec -u root -it mtprotoproxy /usr/bin/python3 manage_users.py remove username

The changes are applied immediately thanks to the hot reload feature - no need to restart the proxy.

Channel Advertising

To advertise a channel get a tag from @MTProxybot and put it to config.py.

Performance

The proxy performance should be enough to comfortably serve about 4 000 simultaneous users on the VDS instance with 1 CPU core and 1024MB RAM.

More Instructions

Advanced Usage

The proxy can be launched:

  • with a custom config: python3 mtprotoproxy.py [configfile]
  • several times, clients will be automaticaly balanced between instances
  • with uvloop module to get an extra speed boost
  • with runtime statistics exported to Prometheus

Star History

Star History Chart

About

Async MTProto proxy for Telegram

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 99.7%
  • Dockerfile 0.3%