Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
M

MTProxy

> 编程语言
Open source

MTProxy Simple MT-Proto proxy Building Install dependencies, you would need common set of tools for building from source, and development p…

6.9K stars0 likes3 views
WebsiteGitHub

About

MTProxy Simple MT-Proto proxy Building Install dependencies, you would need common set of tools for building from source, and development p…

MTProxy

Simple MT-Proto proxy

Building

Install dependencies, you would need common set of tools for building from source, and development packages for openssl and zlib.

On Debian/Ubuntu:

bash
apt install git curl build-essential libssl-dev zlib1g-dev

On CentOS/RHEL:

bash
yum install openssl-devel zlib-devel
yum groupinstall "Development Tools"

Clone the repo:

bash
git clone https://github.com/TelegramMessenger/MTProxy
cd MTProxy

To build, simply run make, the binary will be in objs/bin/mtproto-proxy:

bash
make && cd objs/bin

If the build has failed, you should run make clean before building it again.

Running

  1. Obtain a secret, used to connect to telegram servers.
bash
curl -s https://core.telegram.org/getProxySecret -o proxy-secret
  1. Obtain current telegram configuration. It can change (occasionally), so we encourage you to update it once per day.
bash
curl -s https://core.telegram.org/getProxyConfig -o proxy-multi.conf
  1. Generate a secret to be used by users to connect to your proxy.
bash
head -c 16 /dev/urandom | xxd -ps
  1. Run mtproto-proxy:
bash
./mtproto-proxy -u nobody -p 8888 -H 443 -S <secret> --aes-pwd proxy-secret proxy-multi.conf -M 1

... where:

  • nobody is the username. mtproto-proxy calls setuid() to drop privileges.
  • 443 is the port, used by clients to connect to the proxy.
  • 8888 is the local port. You can use it to get statistics from mtproto-proxy. Like wget localhost:8888/stats. You can only get this stat via loopback.
  • <secret> is the secret generated at step 3. Also you can set multiple secrets: -S <secret1> -S <secret2>.
  • proxy-secret and proxy-multi.conf are obtained at steps 1 and 2.
  • 1 is the number of workers. You can increase the number of workers, if you have a powerful server.

Also feel free to check out other options using mtproto-proxy --help.

  1. Generate the link with following schema: tg://proxy?server=SERVER_NAME&port=PORT&secret=SECRET (or let the official bot generate it for you).
  2. Register your proxy with @MTProxybot on Telegram.
  3. Set received tag with arguments: -P <proxy tag>
  4. Enjoy.

Random padding

Due to some ISPs detecting MTProxy by packet sizes, random padding is added to packets if such mode is enabled.

It's only enabled for clients which request it.

Add dd prefix to secret (cafe...babe => ddcafe...babe) to enable this mode on client side.

Systemd example configuration

  1. Create systemd service file (it's standard path for the most Linux distros, but you should check it before):
bash
nano /etc/systemd/system/MTProxy.service
  1. Edit this basic service (especially paths and params):
bash
[Unit]
Description=MTProxy
After=network.target

[Service]
Type=simple
WorkingDirectory=/opt/MTProxy
ExecStart=/opt/MTProxy/mtproto-proxy -u nobody -p 8888 -H 443 -S <secret> -P <proxy tag> <other params>
Restart=on-failure

[Install]
WantedBy=multi-user.target
  1. Reload daemons:
bash
systemctl daemon-reload
  1. Test fresh MTProxy service:
bash
systemctl restart MTProxy.service
# Check status, it should be active
systemctl status MTProxy.service
  1. Enable it, to autostart service after reboot:
bash
systemctl enable MTProxy.service

Docker image

Telegram is also providing official Docker image. Note: the image is outdated.

Issues· 340 open

View all issuesOpen on GitHub
  • #700

    Compiler Optimization Inappropriately Removes Sensitive Memory Clearing

    Updated Sep 17, 2026
  • #699

    7be6d3af31a65adea57c94c41e50c2b071ed0b3a

    Updated Aug 28, 2026
  • #698

    Hi

    Updated Aug 12, 2026
  • #679

    pid failed more then 65535

    Updated Aug 7, 2026
  • #419

    how to run mtproto on vps with local ip like 192.168.....??

    Updated Jul 7, 2026
  • #674

    Proxy fails to connect to network when running inside a container

    Updated Jun 28, 2026
  • #696

    Fix for MTProto proxy connection issues for RU users (iOS/Android/Desktop on one port)

    Updated Jun 27, 2026
  • #695

    get user tg ID of connected client

    Updated Jun 25, 2026
  • #687

    My first github sayt

    Updated Jun 21, 2026
  • #694

    MTProxy on cf worker?

    Updated Jun 18, 2026

> Tags

C

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 23, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言