Telegram released the official MTProto Proxy Server

image

Finally, after waiting, after close scrutiny and reverse engineering of the MTProto Proxy protocol, Telegram decided to release the official version, with the support of monetization of promoted channels, and also immediately in the Docker image.

What is MTProto Proxy?


This is a specific proxy server and protocol from the creators of Telegram that allows you to bypass locks and monetize its use.

Official proxy


In the last publication was presented a lot of informal implementations of the proxy server, many of them are written by Habr users.

Now we have the official version:

github.com/TelegramMessenger/MTProxy

hub.docker.com/r/telegrammessenger/proxy

What can he do?


  1. Supports up to 16 different keys on 1 proxy
  2. Up to 60,000 connections per core
  3. Has an API to collect statistics (only available locally)
  4. Ready Docker Image
  5. Show Promoted Channels

How to setup?


To disgrace simply:

docker run -d -p443:443 --name=mtproto-proxy --restart=always -v proxy-config:/data telegrammessenger/proxy:latest 

After this we do:

 docker logs mtproto-proxy 

As output you will get:

 #### #### Telegram Proxy #### [+] No secret passed. Will generate 1 random ones. [*] Final configuration: [*] Secret 1: afajkfhjksajkahkhkjkkk [*] tg:// link for secret 1 auto configuration: tg://proxy?server=127.0.0.1&port=443&secret= afajkfhjksajkahkhkjkkk [*] t.me link for secret 1: https://t.me/proxy?server=127.0.0.1&port=443&secret= afajkfhjksajkahkhkjkkk [*] Tag: no tag [*] External IP: 127.0.0.1 [*] Make sure to fix the links in case you run the proxy on a different port. [+] Starting proxy... 

The basic setting itself is complete.

Show Promoted Channel


If you want to show the channel when connecting to a proxy, you need to register the proxy:
This will help the official bot @ MTProxybot

He should send IP: Port + key, in return you will receive a promotional tag.

This tag must be passed as a parameter when the container is started:

 docker run -d -p443:443 --name=mtproto-proxy --restart=always -v proxy-config:/data -e TAG=_TAG telegrammessenger/proxy:latest 

Next, we return to the bot, select our proxy and “Set promotion” - now it remains only to send any channel to display.

That's all, now you have an official Telegram Proxy with the Promotion channel, which will be shown to all users.

Additional settings
By default, the key will be automatically generated at startup and saved in the Docker volume, if you want you can specify another key:
-e SECRET = 00baadf00d15abad1deaa51sbaadcafe
 docker run -d -p443:443 -v proxy-config:/data -e SECRET=00baadf00d15abad1deaa51sbaadcafe telegrammessenger/proxy:latest 


Or a few:

 docker run -d -p443:443 -v proxy-config:/data -e SECRET=935ddceb2f6bbbb78363b224099f75c8,2084c7e58d8213296a3206da70356c81 telegrammessenger/proxy:latest 

Or you can ask to generate several keys for you:

 docker run -d -p443:443 -v proxy-config:/data -e SECRET_COUNT=4 telegrammessenger/proxy:latest 

By default, it launches 2 worker, you can change the setting as follows:
WORKERS = 16

 docker run -d -p443:443 -v proxy-config:/data -e WORKERS=16 telegrammessenger/proxy:latest 

Monitoring is available at: localhost : 2398 / stats

You can get statistics as follows:

 docker exec mtproto-proxy curl http://localhost:2398/stats 

ready_targets: The number of Telegram servers that are ready to service requests from a proxy
active_targets: Number of Telegram servers serving requests with a proxy
total_special_connections: Number of incoming connections
total_max_special_connections: Incoming connections limit

The bot can also show usage statistics for your proxy:


docker-compose


Instead of writing long commands in one line, you can use docker-compose .

You may also be interested.


Source: https://habr.com/ru/post/412755/


All Articles