New Telegram MTProto Proxy Server

A proxy server is an intermediary between the client and the server. To bypass the restrictions, the proxy server should be installed where there are no restrictions on access to the required information, and there should be no such restrictions between the client and the proxy server.

image

Updated Proxy Server Support for Telegram Clients



image

MTProto proxy



Fast start


To run your own MTProto proxy server, you only need a machine with Docker installed and network access. There should be nothing on port 443 (nginx, apache). When you first start the proxy server, a secret key will be created, which will be remembered. Run as one command:

$ docker run -d --net=host --name=mtproto-proxy --restart=always \
    -v proxy-config:/data telegrammessenger/proxy

:

$ docker logs mtproto-proxy

[+] Using the explicitly passed secret: 'b7e70329dcf3721c4239b86ad32a90b8'.
[+] Saving it to /data/secret.
[*] Final configuration:
[*]   Secret 1: b7e70329dcf3721c4239b86ad32a90b8
[*]   tg:// link for secret 1 auto configuration: : tg://proxy?server=81.177.103.94&port=443&secret=b7e70329dcf3721c4239b86ad32a90b8
[*]   t.me link for secret 1: tg://proxy?server=81.177.103.94&port=443&secret=b7e70329dcf3721c4239b86ad32a90b8
[*]   Tag: no tag
[*]   External IP: 81.177.103.94
[*]   Make sure to fix the links in case you run the proxy on a different port.

, - «» , IP .


SECRET:

$ docker run -d --net=host --name=mtproto-proxy --restart=always \
    -v proxy-config:/data -e SECRET=b7e70329dcf3721c4239b86ad32a90b8 \
    telegrammessenger/proxy

- ( ) ( 16). , : boss, managers, users. . ( ) , . ? . . .

:

$ docker run -d --net=host --name=mtproto-proxy --restart=always \
    -v proxy-config:/data -e SECRET=b7e70329dcf3721c4239b86ad32a90b8,afccd434fb32248f29f033b189bd8541,878397a50627deb349d4c296bd9dc3c2 \
     telegrammessenger/proxy

SECRET_COUNT ( 16):

$ docker run -d --net=host --name=mtproto-proxy --restart=always \
    -v proxy-config:/data -e SECRET_COUNT=5 telegrammessenger/proxy

, , Linux:

#    busybox:
$ tr -dc 'a-f0-9' < /dev/urandom | dd bs=1 count=32 2>/dev/null
$ hexdump -n 16 -e '4/4 "%08x" 1 "\n"' /dev/random    #   hexdump
$ openssl rand -hex 16    #  openssl


- . 60000 . - ( , ). WORKERS. , :

$ docker run -d --net=host --name=mtproto-proxy --restart=always \
    -v proxy-config:/data -e WORKERS=16 telegrammessenger/proxy


--net=host. IPv6 , , proxy-server.

, , :

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

- , :

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

, - «» , .


MTProto- . localhost: http://localhost:2398/stats.

- docker --net=host : curl http://localhost:2398/stats, , , nginx - . - docker :

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

:


Telegram - Promoted-. Promoted- — , -. -.

Promoted- @MTProxybot TAG :

$ docker run -d --net=host --name=mtproto-proxy --restart=always \
    -v proxy-config:/data -e TAG=85174e9e0ffa43c0d3a7167e52175268 \
    telegrammessenger/proxy:latest

, .

Promoted- , -. , .

image

-


MTProto- , - :

$ docker pull telegrammessenger/proxy    #  
$ docker stop mtproto-proxy    #  
$ docker rm mtproto-proxy     #  
$ docker run ....  #        
$ docker logs -f --tail=30 mtproto-proxy    #   

Docker Compose


docker-compose.yml:

version: '3.0'

services:
        mtproxy:
                image: telegrammessenger/proxy:latest
                hostname: mtproxy
                container_name: mtproxy.local
                volumes:
                        - proxy-config:/data
                network_mode: "host"
                logging:
                        driver: syslog
                        options:
                                tag: mtproxy
                restart: always
volumes:
        proxy-config:
                external: true

Promoted- TAG.

- c Docker Compose


$ docker-compose pull mtproxy     #  
$ docker-compose up -d   #    
$ docker-compose logs -f --tail=30 mtproxy    #   

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


All Articles