Telegram Messenger MTProto proxy server (Alpine).
598

$ docker pull deercloud/mtproxy
$ docker run -p 443:443 -d --restart always deercloud/mtproxy:latest --name=mtproxy
This starts a container of the latest release with all the default settings, which is equivalent to
$ mtproto-proxy \
--slaves 1 \
--user nobody \
--port 8888 \
--http-ports 443 \
--mtproto-secret $(random) \
--proxy-tag $(random) \
--address 0.0.0.0 \
--nat-info "$(local_addr):$(global_addr)" \
--aes-pwd /etc/mtproxy/proxy-secret \
/etc/mtproxy/proxy-multi.conf \
$ARGS
Note: mtproto-secret & proxy-tag will be generate by
/dev/urandom
The container's log output will contain the links to paste into the Telegram app:
$ docker logs mtproxy
Using explicitly passed mtproto-secret: efcaec3bc7102890adb444b3d24660fb
Generating random proxy-tag: 6a34cd54d81652d9b0657c79848f144b
Using the detected global-addr: 1.1.1.1
Using the detected local-addr: 192.168.240.1
Starting MTProxy......
https://t.me/proxy?server=1.1.1.1&port=443&secret=efcaec3bc7102890adb444b3d24660fb
https://t.me/proxy?server=1.1.1.1&port=443&secret=ddefcaec3bc7102890adb444b3d24660fb
!! replace 443 to your different port.
:warning: You may forward any other port to the container's 443: be sure to fix the automatic configuration links if you do so.
In most cases you'll want to change a thing or two, for instance the port which the server listens on. This is done by changing the -p arguments.
Here's an example to start a container that listens on 1443:
$ docker run -p 1443:443 -d --restart always deercloud/mtproxy:latest --name=mtproxy
:warning: DONOT change
:443to other ports.
Another thing you may want to change is the secret. To change that, you can pass your own secret as an environment variable when starting the container.
Generate a secret to be used by users to connect to your proxy.
$ head -c 16 /dev/urandom | xxd -ps
efcaec3bc7102890adb444b3d24660fb
Here's an example to start a container with efcaec3bc7102890adb444b3d24660fb as the secret:
$ docker run -e SECRET=efcaec3bc7102890adb444b3d24660fb -p 443:443 -d --restart always deercloud/mtproxy:latest --name=mtproxy
Besides SECRET, the image also defines the following environment variables that you can customize:
TAG: Set proxy received tag, random by defaultSLAVES: Spawn several slave workersARGS: Append other variablesIt is very handy to use docker-compose to manage docker containers. You can download the binary at https://github.com/docker/compose/releases.
This is a sample docker-compose.yml file.
version: '3'
services:
mtproxy:
image: deercloud/mtproxy
container_name: mtproxy
restart: always
environment:
- SECRET=efcaec3bc7102890adb444b3d24660fb
- TAG=6a34cd54d81652d9b0657c79848f144b
ports:
- "443:443"
It is highly recommended that you setup a directory tree to make things easy to manage.
$ mkdir -p ~/fig/mtproxy/
$ cd ~/fig/mtproxy/
$ curl -sSLO https://raw.githubusercontent.com/DeerCloud/Dockerfile/master/MTProxy/docker-compose.yml
$ docker-compose up -d
$ docker-compose ps
$ docker-compose logs
Once your MTProxy server is up and running go to @MTProxybot and register your proxy with Telegram to gain access to usage statistics and monetization.
The MTProto proxy server exports internal statistics as tab-separated values over the http://127.0.0.1:8888/stats endpoint. Please note that this endpoint is available only from localhost: depending on your configuration, you may need to collect the statistics with:
$ docker exec mtproxy curl 127.0.0.1:8888/stats
Deer Cloud © metowolf, Released under the MIT License.
Blog @meto · GitHub @metowolf · Twitter @metowolf · Telegram Channel @metooooo
Content type
Image
Digest
Size
3.1 MB
Last updated
almost 8 years ago
docker pull deercloud/mtproxy