Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "MTProxy"]
path = MTProxy
url = git@github.com:TelegramMessenger/MTProxy.git
url = https://github.com/TelegramMessenger/MTProxy.git
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ LABEL maintainer="Alex Doe <[email protected]>" \
description="Telegram Messenger MTProto zero-configuration proxy server."

RUN apk add --no-cache curl \
&& apk update \
&& apk upgrade apk --no-cache \
&& ln -s /usr/lib/libcrypto.so.41 /usr/lib/libcrypto.so.1.0.0
# alpine:3.7 will need symlink to libcrypto.so.42

Expand Down
2 changes: 1 addition & 1 deletion MTProxy
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@

The Telegram Messenger MTProto proxy is a zero-configuration container that automatically sets up a proxy server that speaks Telegram's native MTProto.

[![](https://images.microbadger.com/badges/image/homdx/mtproxy.svg)](https://microbadger.com/images/homdx/mtproxy "Get your own image badge on microbadger.com")

[![](https://images.microbadger.com/badges/version/homdx/mtproxy.svg)](https://microbadger.com/images/homdx/mtproxy "Get your own version badge on microbadger.com")

## Quick reference
To start the proxy all you need to do is
`docker run -d -p443:443 --name=mtproxy --restart=always -v ./config:/data alexdoesh/mtproxy:latest`
`docker run -d -p443:443 --name=mtproxy --restart=always -v ./config:/data homdx/mtproxy:latest`

The container's log output (`docker logs mtproxy`) will contain the links to paste into the Telegram app:

Expand All @@ -28,19 +32,19 @@ Once your MTProxy server is up and running go to [@MTProxybot](https://t.me/mtpr

## Custom configuration
If you need to specify a custom secret (say, if you are deploying multiple proxies with DNS load-balancing), you may pass the SECRET environment variable as 16 bytes in lower-case hexidecimals.:
`docker run -d -p443:443 -v ./config:/data -e SECRET=00baadf00d15abad1deaa51sbaadcafe alexdoesh/mtproxy:latest`
`docker run -d -p443:443 -v ./config:/data -e SECRET=00baadf00d15abad1deaa51sbaadcafe homdx/mtproxy:latest`

The proxy may be configured to accept up to 16 different secrets. You may specify them explicitly as comma-separated hex strings in the SECRET environment variable, or you may let the container generate the secrets automatically using the SECRET_COUNT variable to limit the number of generated secrets.

`docker run -d -p443:443 -v ./config:/data -e SECRET=935ddceb2f6bbbb78363b224099f75c8,2084c7e58d8213296a3206da70356c81 telegrammessenger/proxy:latest`
`docker run -d -p443:443 -v ./config:/data -e SECRET_COUNT=4 alexdoesh/mtproxy:latest`
`docker run -d -p443:443 -v ./config:/data -e SECRET_COUNT=4 homdx/mtproxy:latest`

A custom advertisement tag may be provided using the TAG environment variable:
`docker run -d -p443:443 -v ./configg:/data -e TAG=3f40462915a3e6026a4d790127b95ded alexdoesh/mtproxy:latest`.
`docker run -d -p443:443 -v ./config:/data -e TAG=3f40462915a3e6026a4d790127b95ded homdx/mtproxy:latest`.
Please note that the tag is not persistent: you'll have to provide it as an environment variable every time you run an MTProto proxy container.

A single worker process is expected to handle tens of thousands of clients on a modern CPU. For best performance we artificially limit the proxy to 60000 connections per core and run two workers by default. If you have many clients, be sure to adjust the WORKERS variable:
`docker run -d -p443:443 -v ./config:/data -e WORKERS=16 alexdoesh/mtproxy:latest`
`docker run -d -p443:443 -v ./config:/data -e WORKERS=16 homdx/mtproxy:latest`

## Monitoring
The MTProto proxy server exports internal statistics as tab-separated values over the http://localhost:2398/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 mtproto-proxy curl http://localhost:2398/stats`.
Expand Down