Total Pageviews

Sunday, 8 July 2018

专为 Telegram 设计的代理工具 —— MTProxy

专门为 Telegram 开发的代理软件,代理服务端限制了客户端只允许访问 Telegram 的服务器。

相比于使用其他代理软件,然后 Telegram 配置链接本地代理软件而言,该方法更方便一些,无需每次启动 Telegram 都需要先启动代理软件,特别是对于手机使用者来说。

至于该软件的特性,大概就是占用资源少、使用方便、Telegram官方支持(是不是官方开发的我也不知道,估计不是)。

而且,今年4月俄罗斯封禁了 Telegram,5月底 MTProxy 第一个版本就出来了,考虑到开发时间,怕是因为俄罗斯封禁的原因而促使 Telegram 官方要搞个 Telegram 专用的代理工具了。

注意:MTProxy 仅支持 Telegram 客户端使用,无法用于代理其他网站和软件!
--------------

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 git curl build-essential libssl-dev zlib1g-dev
On CentOS/RHEL:
yum install openssl-devel zlib-devel
yum groupinstall "Development Tools"
Clone the repo:
git clone https://github.com/TelegramMessenger/MTProxy
cd MTProxy
To build, simply run make, the binary will be in objs/bin/mtproto-proxy:
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.
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 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.

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]
After=network.target

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

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

Docker image

Telegram is also providing official Docker image.

from https://github.com/TelegramMessenger/MTProxy
-------

MTProxy 一键搭建管理脚本  

MTProxy-Bash

MTProxy 一键搭建管理脚本。 MTProxy 是专门用于 Telegram 的代理软件。目前 Telegram 内部直接支持此代理软件。安装完成后生成的 tg:// 链接可在 Telegram 内随意分享使用。代理效果非常出色。

截图

1.png 2.png

安装

wget -N --no-check-certificate https://raw.githubusercontent.com/FunctionClub/MTProxy-Bash/master/install.sh && bash install.sh

卸载

wget -N --no-check-certificate https://raw.githubusercontent.com/FunctionClub/MTProxy-Bash/master/uninstall.sh && bash uninstall.sh
 
 from https://github.com/FunctionClub/MTProxy-Bash

No comments:

Post a Comment