Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

 
 

Latest commit

 

History

20 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MTProxy

Building

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

On Debian/Ubuntu:

apt install build-essential libssl-dev zlib1g-dev

On CentOS/RHEL:

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

To build, simply run make. Your binary will be in objs/bin/mtproto-proxy. If build was failed, you would do make clear at first, before building it again.

Running

  1. Obtain a secret, used to connect to telegram servers.
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.
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.
head -c 16 /dev/urandom | xxd -ps
  1. Run mtproto-proxy:
./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 privilegies.
  • 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 followed schema: tg://proxy?server=SERVER_NAME&port=443&secret=SECRET (by the way official bot provides links anyway).
  2. Register your proxy with @MTProxybot on Telegram.
  3. Set received tag as param -P <proxy tag>
  4. Enjoy.

Systemd example configuration

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

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

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

Docker image

Telegram is also providing official Docker image.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages