ุฎุงุฏู… MTProto ุงู„ูˆูƒูŠู„ ุงู„ุฌุฏูŠุฏ ู…ู† Telegram

ุงู„ุฎุงุฏู… ุงู„ูˆูƒูŠู„ ู‡ูˆ ูˆุณูŠุท ุจูŠู† ุงู„ุนู…ูŠู„ ูˆุงู„ุฎุงุฏู…. ู„ู„ุชุญุงูŠู„ ุนู„ู‰ ุงู„ู‚ูŠูˆุฏ ุŒ ูŠุฌุจ ุชุซุจูŠุช ุฎุงุฏู… ูˆูƒูŠู„ ุญูŠุซ ู„ุง ุชูˆุฌุฏ ู‚ูŠูˆุฏ ุนู„ู‰ ุงู„ูˆุตูˆู„ ุฅู„ู‰ ุงู„ู…ุนู„ูˆู…ุงุช ุงู„ู…ุทู„ูˆุจุฉ ุŒ ููŠ ุญูŠู† ู„ุง ูŠู†ุจุบูŠ ุฃู† ุชูƒูˆู† ู‡ู†ุงูƒ ู…ุซู„ ู‡ุฐู‡ ุงู„ู‚ูŠูˆุฏ ุจูŠู† ุงู„ุนู…ูŠู„ ูˆุงู„ุฎุงุฏู… ุงู„ูˆูƒูŠู„.

ุงู„ุตูˆุฑุฉ

ุฏุนู… ูˆูƒูŠู„ ู…ุญุฏุซ ู„ุนู…ู„ุงุก Telegram


  • ูˆูƒูŠู„ MTProto ุงู„ุฌุฏูŠุฏ. ูŠุนู…ู„ ู…ุน MTProto ุจุฑูˆุชูˆูƒูˆู„ Telegram ุงู„ุฃุตู„ูŠ
  • GitHub ุฎุงุฏู… ู…ูุชูˆุญ ุงู„ู…ุตุฏุฑ
  • ุตูˆุฑุฉ ุนุงู…ู„ ุงู„ู…ูŠู†ุงุก ุนู„ู‰ DockerHub
  • ููŠ ุงู„ุฃุฌู‡ุฒุฉ ุงู„ู…ุญู…ูˆู„ุฉ ุŒ ุฃุตุจุญ ู…ู† ุงู„ู…ู…ูƒู† ุฅุถุงูุฉ ุงู„ุนุฏูŠุฏ ู…ู† ุงู„ูˆูƒู„ุงุก ู…ู† ูƒู„ ู†ูˆุน. ูŠู…ูƒู† ู„ู„ู…ุณุชุฎุฏู… ุงุฎุชูŠุงุฑ ุงู„ุฃู†ุณุจ

ุงู„ุตูˆุฑุฉ

ูˆูƒูŠู„ MTProto


  • ูŠุนู…ู„ MTProto-proxy ูู‚ุท ู…ุน Telegram
  • ู„ุง ูŠูˆุฌุฏ ู„ุฏู‰ ุงู„ุนู…ูŠู„ ูˆุงู„ุฎุงุฏู… ู…ุฑุญู„ุฉ ุชุจุงุฏู„ ู…ุนู„ูˆู…ุงุช ู…ูุชูˆุญุฉ
  • ููŠ ุชู†ููŠุฐ ุฎุงุฏู… MTProto-proxy ู…ู† Telegram ุŒ ู„ุง ูŠู…ุชู„ูƒ ุงู„ุฎุงุฏู… ุงู„ูˆูƒูŠู„ ูˆู…ุงู„ูƒู‡ ูˆุตูˆู„ุงู‹ ู…ุจุงุดุฑู‹ุง ุฅู„ู‰ ุงู„ู…ุนู„ูˆู…ุงุช ุงู„ูˆุตููŠุฉ ู„ุจุฑูˆุชูˆูƒูˆู„ MTProxy (ุชุณุฌูŠู„ุงุช ุงู„ุฏุฎูˆู„ ุนู„ู‰ ุณุจูŠู„ ุงู„ู…ุซุงู„).
  • ุจุงู„ู†ุณุจุฉ ุฅู„ู‰ ุฌู…ูŠุน ุฃู†ูˆุงุน ุงู„ูู„ุงุชุฑ ูˆุงู„ู…ุญู„ู„ุงุช ุŒ ูŠุจุฏูˆ ุชุจุงุฏู„ ุงู„ุจูŠุงู†ุงุช ู…ุน ุฎุงุฏู… MTProto-proxy ุจู…ุซุงุจุฉ ุฏูู‚ ุจูŠุงู†ุงุช ุซู†ุงุฆูŠ ุงู„ุงุชุฌุงู‡ ุบูŠุฑ ู…ู†ุธู… ุจูŠู† ุงู„ุนู…ูŠู„ ูˆุงู„ุฎุงุฏู…. ูˆู‡ุฐุง ูŠุฌุนู„ ู…ู† ุงู„ุตุนุจ ุชุญุฏูŠุฏ ุงู„ุชุนุฑู ุนู„ู‰ ุงู„ุจุฑูˆุชูˆูƒูˆู„.

ุจุฏุงูŠุฉ ุณุฑูŠุนุฉ


ู„ุจุฏุก ุชุดุบูŠู„ ุฎุงุฏู… ูˆูƒูŠู„ MTProto ุงู„ุฎุงุต ุจูƒ ุŒ ู„ุง ูŠู„ุฒู… ุณูˆู‰ ุฌู‡ุงุฒ ู…ุซุจุช ุนู„ูŠู‡ Docker ูˆุงู„ูˆุตูˆู„ ุฅู„ู‰ ุงู„ุดุจูƒุฉ. ูŠุฌุจ ุฃู„ุง ูŠูƒูˆู† ู‡ู†ุงูƒ ุฃูŠ ุดูŠุก ุนู„ู‰ ุงู„ู…ู†ูุฐ 443 (nginx ุŒ apache). ููŠ ุงู„ุจุฏุงูŠุฉ ุงู„ุฃูˆู„ู‰ ู„ู„ุฎุงุฏู… ุงู„ูˆูƒูŠู„ ุŒ ุณูŠุชู… ุฅู†ุดุงุก ู…ูุชุงุญ ุณุฑูŠ ุŒ ุณูŠุชู… ุชุฐูƒุฑู‡. ูŠุนู…ู„ ุจุฃู…ุฑ ูˆุงุญุฏ:

$ 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

:
  • ready_targets โ€” Telegram, c -
  • active_targets โ€” Telegram ( ready_targets)
  • total_special_connections โ€”
  • total_max_special_connections โ€”


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/ar412759/


All Articles