逗比云还是逃不过被墙的命运,既然如此那以后逗比云也就一直用被墙的旧域名 [softs.wtf] 算了。
投稿文章 | 广告合作 | Telegram 群组 / 公告频道 / 使用教程
广告

『原创』Telegram 专用的轻量化代理工具 —— MTProxy 一键脚本

Shell脚本 Toyo 168评论
广告
本文最后更新于 2018年11月10日 16:01 可能会因为没有更新而失效。如已失效或需要修正,请留言!

最近有人给我推荐了个代理软件,查了下发现是专门为 Telegram 开发的代理软件,代理服务端限制了客户端只允许访问 Telegram 的服务器。

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

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

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

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

逗比根据地 交流群组:https://t.me/doubi

逗比根据地 公告频道:https://t.me/doubi_a

Telegram 使用教程:https://doub.io/telegram-jc1/


Github 项目地址:https://github.com/TelegramMessenger/MTProxy

官方项目为 C 语言编写,另一个 Go 语言编写的:『原创』MTProxy Go版 一键脚本


为什么要用 MTProxy ?为何不直接用代理软件?

可能有人会疑问:MTProxy 是一个只能 Telegram 客户端使用的代理,那么为什么不直接用其他代理软件呢?

我就特地来回答一下大家的疑问。

1. 移动设备便捷性:对于电脑用户来说, MTProxy 相对鸡肋,因为很多人都是代理软件开机启动并且全天不关。但是对于手机用户来说,每次要查看 Telegram 客户端,都需要先开启代理软件,而如果你在手机上不是经常要挂代理,但是你会经常去 Telegram 里吹比打屁,那么你就很适合使用 MTProxy 了,它可以让你使用 Telegram 客户端像使用国内的 QQ、微信一样方便,打开即用。

2. 适合分享给朋友:当你觉得 TG很好用,想要劝身边的朋友抛弃 QQ、微信 转投 Telegram 时,你却发现你还需要给他配置一套代理软件、代理账号,指导他如何使用代理软件,巴拉巴拉的。但是如果你有 MTProxy 代理账号,那么只需要填写代理配置后,即可直接使用!


系统要求

CentOS 7 / Debian 7+ / Ubuntu 14.04 +

推荐 Debian 7/8 x64,这个是我一直使用的系统,我的脚本在这个系统上面出错率最低。

注意:因为 CentOS 6 系统的 GCC 版本过低,会导致编译失败报错这个),请使用更高版本的系统!


脚本版本

Ver: 1.0.8


安装步骤

执行下面的代码下载并运行脚本。

wget -N --no-check-certificate https://raw.githubusercontent.com/ToyoDAdoubiBackup/doubi/master/mtproxy.sh && chmod +x mtproxy.sh && bash mtproxy.sh

运行脚本后会出现脚本操作菜单,选择并输入 1 就会开始安装。

点击展开 查看更多


使用说明

进入下载脚本的目录并运行脚本:

./mtproxy.sh

然后选择你要执行的选项即可。

  MTProxy 一键管理脚本 [vX.X.X]
  ---- Toyo | doub.io/shell-jc7 ----
  
  0. 升级脚本
————————————
  1. 安装 MTProxy
  2. 更新 MTProxy
  3. 卸载 MTProxy
————————————
  4. 启动 MTProxy
  5. 停止 MTProxy
  6. 重启 MTProxy
————————————
  7. 设置 账号配置
  8. 查看 账号信息
  9. 查看 日志信息
 10. 查看 链接信息
————————————

 当前状态: 已安装 并 已启动

 请输入数字 [0-10]:

其他操作

启动:/etc/init.d/mtproxy start

停止:/etc/init.d/mtproxy stop

重启:/etc/init.d/mtproxy restart

查看状态:/etc/init.d/mtproxy status

安装目录:/usr/local/mtproxy

配置文件:/usr/local/mtproxy/mtproxy.conf

日志文件:/usr/local/mtproxy/mtproxy.log


Telegram 使用方法说明:

如果你的 TG 客户端没有 Mtproto 代理选项,那么请更新到最新版本

Telegram 内置了 Mtproto 代理选项,所以TG客户端内点击 tg://proxy?xxxx... 链接就会自动配置代理,非常方便。


PC 使用步骤

点击展开 查看更多


分享代理账号并推广频道

MTProxy 有个官方机器人,可以让你在此分享 MTProxy 代理账号,但是只分享没收获的话,大家都没什么动力,所以 MTProxy 机器人可以让你分享出去的免费账号起到推广频道的作用,使用你机器人处分享的免费账号的人都会在聊天列表里看到推广频道信息。

机器人:https://t.me/MTProxybot@MTProxybot

点击展开 查看更多


其他说明

注意:MTProxy 仅支持 Telegram 客户端使用,无法用于其他软件!


Telegram一直无法连接代理的可能原因之一

点击展开 查看更多


 编译失败,提示包含 xxxxx option "-std=gnu11" 错误

点击展开 查看更多


启动失败,日志提示 'S' option requires exactly 32 hex digits 错误

该问题只出现于自定义密码时,因为 MTProxy 为了安全性而要求密码必须是 32位(多了少了都不行),如果数量不对就会提示这个,建议用脚本随机生成!


启动失败,日志显示 mtproto-proxy: common/pid.c:42: init_common_PID: Assertion '!(p & 0xffff0000)' failed.

Azure的服务器可能会出现该问题,具体见评论:#comment-43366


提示wget: unknown host “raw.githubusercontent.com” 之类的错误

点击展开 查看更多


提示 wget: command not found 的错误

点击展开 查看更多


升级脚本

升级脚本只需要重新下载脚本文件就可以了,会自动覆盖原文件。

更新日志

2018年11月10日,版本 v1.0.8

1. 新增 监测外网IP变更功能(位于 7. 设置 账号配置 中)。

—— 该功能适合于IP经常变更的服务器,不需要每次都手动修改了。

点击展开 查看更多


逗比根据地 交流群组:https://t.me/doubi

逗比根据地 公告频道:https://t.me/doubi_a

转载请超链接注明:逗比根据地 » 『原创』Telegram 专用的轻量化代理工具 —— MTProxy 一键脚本
责任声明:本站一切资源仅用作交流学习,请勿用作商业或违法行为!如造成任何后果,本站概不负责!

赞 (1189)
发表我的评论
取消评论
表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
(168)个小伙伴在吐槽
  1. net/net-crypto-dh.c: In function ‘create_g_a’:
    net/net-crypto-dh.c:150:5: warning: ‘RAND_pseudo_bytes’ is deprecated [-Wdeprecated-declarations]
         assert (RAND_pseudo_bytes (a, 256) >= 0); /* if you write '>0', the assert will fail. It's very sad */
         ^~~~~~
    In file included from /usr/include/openssl/crypto.h:32:0,
                     from /usr/include/openssl/bn.h:33,
                     from net/net-crypto-dh.c:36:
    /usr/include/openssl/rand.h:47:1: note: declared here
     DEPRECATEDIN_1_1_0(int RAND_pseudo_bytes(unsigned char *buf, int num))
    这段内容有影响不?
    
    糖炒栗子2018-11-03 21:14 回复
    • 影响使用吗?如果不影响就无视,影响的话就去 Github 向作者反馈。
      Toyo2018-11-03 22:26 回复
  2. 有个问题请教,为什么我的自动密钥生成的是34位的?而不是32位的呢?
    fhbtothe2018-11-02 08:27 回复
    • 密匙前面的 dd 字符代表客户端通过随即混淆安全模式链接服务端,推荐使用,因为一些人发现在伊朗不使用该模式活不过多长时间。如果你要去官方机器人处分享账号并获取TAG,那么你需要去掉这个 dd 字符,分享给他人时再加上。
      另外,不要重复问同一个问题,每个评论我都会一一查看,你无论在哪个文章页面发布的评论我都能看到。
      Toyo2018-11-02 12:51 回复
  3. 有问题啊,密码不是[a-z][A-z],应该是[a-f]
    月がきれい2018-10-27 22:50 回复
    • [0-9][a-z][A-z] 这个指的是手动填写密码的字符范围。
      脚本随机生成靠的是 当前时间戳+当前纳秒 MD5加密后取前32位得来的,而MD5的加密机制是 [0-9][a-f]。
      范围指的是你必须使用该范围内字符,但不代表你必须使用该范围内所有字符。
      Toyo2018-10-28 00:16 回复
  4. CentOS 7 / Debian 7+ / Ubuntu 14.04 + 老大。你确定没写错吗。你的脚本从没出现过centos7的。要确认一下。
    wenreg2018-10-26 19:43 回复
    • 没写错,因为 CentOS6 因为系统依赖原因会导致编译失败。
      CentOS7是正常的,不过默认防火墙配置自行负责。
      我写的其他脚本也很多支持 CentOS7的,不过因为支持 CentOS6 所以我往往写作 CentOS6+
      Toyo2018-10-26 20:16 回复
  5. 那个,大佬好,我想问一下为什么MTP代理除了开80和443端口正常连接外,其余端口虽然可以正常启动(日志也不会报错),但一律连接不上。服务器是谷歌云并且已经输入了10.x.x.x的代理,防火墙也把全端口全协议开起来了,是为什么呢
    chunyi2018-10-22 16:39 回复
    • 使用其他端口时,请用 TCPing 检测端口连通性。
      Toyo2018-10-22 19:49 回复
  6. --2018-10-18 14:42:07--  https://softs.loan/Bash/other/mtproxy_debian
    Resolving softs.loan (softs.loan)... 38.106.22.14
    Connecting to softs.loan (softs.loan)|38.106.22.14|:443... connected.
    HTTP request sent, awaiting response... 404 Not Found
    2018-10-18 14:42:07 ERROR 404: Not Found.
    这个什么意思呢?????
    
    Wicked2018-10-18 14:45 回复
    • 请更新为最新脚本(Github),逗比云已不再存放脚本文件。
      Toyo2018-10-18 14:52 回复
  7. 启动报错 /etc/init.d/mtproxy: line 52: 30083 Killed nohup ./mtproto-proxy -u nobody -p 65432 -H 45233 -S 849b7f944202eaa49800cb671bf91fee --nat-info "10.140.0.9:外网IP" --aes-pwd proxy-secret proxy-multi.conf 用的是谷歌云,Toyo大神求解决
    sagent2018-10-17 15:17 回复
    • 这报错信息基本等于没说,请贴出更详细的。
      Toyo2018-10-17 18:26 回复
  8. [错误] MTProxy 启动失败 !请查看日志文件检查问题所在。 这是怎么回事,哪个大神给指教下
    lanshui8862018-10-15 16:23 回复
    • 请贴出日志内容。
      Toyo2018-10-15 18:12 回复
      • 当前状态: 已安装 但 未启动
         请输入数字 [0-10]:9
        [注意] 按 Ctrl+C 终止查看日志
        如果需要查看完整日志内容,请用 cat /usr/local/mtproxy/mtproxy.log 命令。
                --io-threads                       Number of I/O threads (1-64, default 16)
                --allow-skip-dh                         Allow skipping DH during RPC handshake
                --force-dh                              Force using DH for all outbound RPC connections
                --max-accept-rate                  max number of connections per second that is allowed to accept
                --max-dh-accept-rate               max number of DH connections per second that is allowed to accep
        t
                --multithread {arg}                     run in multithread mode
                --tcp-cpu-threads                  number of tcp-cpu threads
                --tcp-iothreads                    number of tcp-io threads
                --nat-info                         :      sets network address translation
         for RPC protocol handshake
                --address                          tries to bind socket only to specified address
        
        蓝水2018-10-16 16:29 回复
        • cat /usr/local/mtproxy/mtproxy.log 请提供完整日志。
          Toyo2018-10-16 17:40 回复
          • usage: ./mtproto-proxy [-v] [-6] [-p] [-H{,}] [-M] [-u] [-b] [-c] [-l] [-W] 
            mtproxy-0.01 compiled at Oct 16 2018 16:21:14 by gcc 6.3.0 20170516 64-bit after commit f9158e3129efd4ccdc291aef
            b840209791226a77
                    Simple MT-Proto proxy
                    --ipv6/-6                               enables ipv6 TCP/UDP support
                    --max-special-connections/-C       sets maximal number of accepted client connections per worker
                    --http-ports/-H                    comma-separated list of client (HTTP) ports to listen
                    --slaves/-M                        spawn several slave workers
                    --proxy-tag/-P                     16-byte proxy tag in hex mode to be passed along with all forwar
            ded queries
                    --mtproto-secret/-S                16-byte secret in hex mode
                    --ping-interval/-T                 sets ping interval in second for local TCP connections (default 
            5.000)
                    --window-clamp/-W                  sets window clamp for client TCP connections
                    --backlog/-b                       sets backlog size
                    --connections/-c                   sets maximal connections number
                    --daemonize/-d {arg}                    changes between daemonize/not daemonize mode
                    --help/-h                               prints help and exits
                    --log/-l                           sets log file name
                    --port/-p                           or : sets listening port number or port ran
            ge
                    --user/-u                          sets user name to make setuid
                    --verbosity/-v {arg}                    sets or increases verbosity level
                    --aes-pwd                          sets custom secret.conf file
                    --nice                             sets niceness
                    --msg-buffers-size                 sets maximal buffers size (default 268435456)
                    --disable-tcp                           do not open listening tcp socket
                    --crc32c                                Try to use crc32c instead of crc32 in tcp rpc
                    --cpu-threads                      Number of CPU threads (1-64, default 8)
                    --io-threads                       Number of I/O threads (1-64, default 16)
                    --allow-skip-dh                         Allow skipping DH during RPC handshake
                    --force-dh                              Force using DH for all outbound RPC connections
                    --max-accept-rate                  max number of connections per second that is allowed to accept
                    --max-dh-accept-rate               max number of DH connections per second that is allowed to accep
            t
                    --multithread {arg}                     run in multithread mode
                    --tcp-cpu-threads                  number of tcp-cpu threads
                    --tcp-iothreads                    number of tcp-io threads
                    --nat-info                         :      sets network address translation
             for RPC protocol handshake
                    --address                          tries to bind socket only to specified address
            [email protected]:~# 
            Page down
            十分感谢了!
            
            lanshui8862018-10-19 18:06 回复
            • 确定是完整的日志内容?你这里面没有能说明启动失败的日志内容。
              Toyo2018-10-19 18:46 回复
              • usage: ./mtproto-proxy [-v] [-6] [-p] [-H{,}] [-M] [-u] [-b] [-c] [-l] [-W] mtproxy-0.01 compiled at Oct 16 2018 16:21:14 by gcc 6.3.0 20170516 64-bit after commit f9158e3129efd4ccdc291aef b840209791226a77 Simple MT-Proto proxy --ipv6/-6 enables ipv6 TCP/UDP support --max-special-connections/-C sets maximal number of accepted client connections per worker --http-ports/-H comma-separated list of client (HTTP) ports to listen --slaves/-M spawn several slave workers --proxy-tag/-P 16-byte proxy tag in hex mode to be passed along with all forwar ded queries --mtproto-secret/-S 16-byte secret in hex mode --ping-interval/-T sets ping interval in second for local TCP connections (default 5.000) --window-clamp/-W sets window clamp for client TCP connections --backlog/-b sets backlog size --connections/-c sets maximal connections number --daemonize/-d {arg} changes between daemonize/not daemonize mode --help/-h prints help and exits --log/-l sets log file name --port/-p or : sets listening port number or port ran ge --user/-u sets user name to make setuid --verbosity/-v {arg} sets or increases verbosity level --aes-pwd sets custom secret.conf file --nice sets niceness --msg-buffers-size sets maximal buffers size (default 268435456) --disable-tcp do not open listening tcp socket --crc32c Try to use crc32c instead of crc32 in tcp rpc --cpu-threads Number of CPU threads (1-64, default 8) --io-threads Number of I/O threads (1-64, default 16) --allow-skip-dh Allow skipping DH during RPC handshake --force-dh Force using DH for all outbound RPC connections --max-accept-rate max number of connections per second that is allowed to accept --max-dh-accept-rate max number of DH connections per second that is allowed to accep t --multithread {arg} run in multithread mode --tcp-cpu-threads number of tcp-cpu threads --tcp-iothreads number of tcp-io threads --nat-info : sets network address translation for RPC protocol handshake --address tries to bind socket only to specified address [email protected]:~# Page down 我就是按照您给的命令写进去的,您看看还有别的办法吗,谢谢了
                lanshui8862018-10-19 20:02 回复
                • Telegram群组(TG使用教程进群后联系 @Toyo233 )私聊联系我讨论解决。
                  Toyo2018-10-19 21:52 回复
                  • 您能来个连接吗,我不太会加tg,谢谢
                    蓝水8862018-10-23 14:29 回复
                    • 安装 PC TG客户端后(且登陆),点击链接就能加群,或者 TG 网页端也行。
                      Toyo2018-10-23 18:03
  9. "当你安装 MTProxy 出现编译错误,并且编译错误信息中包含的有 ccl: error: unrecognized command line option "-std=gnu11" 类似内容(往往在编译错误这几个字的上方几条内),则说明是系统的 OpenSSL 版本过低,不支持部分编译参数。" gcc 版本过低. 把 makefile 里 -std=gnu11 这个删掉就可以正常编译了, centos 6亲测.
    隔壁老马2018-09-29 14:57 回复
  10. 一直显示连接中,但却连接不上。配置应该没有问题,我把新加坡阿里云服务器设置成了北京时区,还是无法连接上。
    vguhang2018-09-27 09:47 回复
    • 阿里服务器需要设置NAT 填内网地址 :mrgreen:
      Aisuka2018-10-10 10:10 回复
  11. 一直显示,connecting ... 不论是pc 端还是手机端,telnet 端口也是通的,实在不是什么原因。
    Hayden2018-09-24 18:08 回复
    • 检查服务器时间与本地设备时间是否相差过大。
      Toyo2018-09-24 18:36 回复
  12. 搭建mtproxy容易被封IP么
    luoye2018-09-22 01:25 回复
    • 目前还是安全的。
      Toyo2018-09-22 01:56 回复
  13. azure的服务器运行可能会导致启动失败,日志显示mtproto-proxy: common/pid.c:42: init_common_PID: Assertion `!(p & 0xffff0000)' failed. 因为架构的问题,需要注释掉https://github.com/TelegramMessenger/MTProxy/blob/master/common/pid.c#L42这行,重新编译即可,避免踩坑。 详情见https://github.com/TelegramMessenger/MTProxy/issues/41
    你说2018-09-19 13:37 回复
  14. Toyo大大,NAT小鸡每次自动改IP后,就不可连了,能否启动或者重启时检查IP有没有变化并修改配置文件?或者有其他方法能解决?谢谢!
    weking2018-09-18 11:24 回复
    • 每天NAT自动更换IP后,mtproxy.conf里NAT那一行的外网IP还是上一次的旧IP,并不会自动更新。必须手动改成最新的才能使代理生效,能否定期检查IP并自动更新mtproxy.conf的配置呢?
      weking2018-09-23 14:03 回复
  15. centos升级gcc的可以试一下这里的脚本,亲测成功 https://superuser.com/questions/381160/how-to-install-gcc-4-7-x-4-8-x-on-centos
    热心市民小曹2018-09-17 18:22 回复
  16. Debian 9        这是怎么回事
    
    [9427][2018-09-15 07:51:44.461884 local] Invoking engine mtproxy-0.01 compiled at Sep 15 2018 07:51:04 by gcc 6.3.0 20170516 64-bit after commit f9158e3129efd4ccdc291aefb840209791226a77
    [9427][2018-09-15 07:51:44.462196 local] config_filename = 'proxy-multi.conf'
    [9427][2018-09-15 07:51:44.462635 local] fatal: cannot load secret definition file `proxy-secret'
    [9495][2018-09-15 07:52:34.762234 local] Invoking engine mtproxy-0.01 compiled at Sep 15 2018 07:51:04 by gcc 6.3.0 20170516 64-bit after commit f9158e3129efd4ccdc291aefb840209791226a77
    [9495][2018-09-15 07:52:34.762526 local] config_filename = 'proxy-multi.conf'
    [9495][2018-09-15 07:52:34.762878 local] fatal: cannot load secret definition file `proxy-secret'
    
    Nanimono2018-09-15 07:56 回复
    • 你看一下这个文件在不在,是否为空:/usr/local/mtproxy/proxy-secret
      Toyo2018-09-15 10:50 回复
      • 看了下,是空的。
        Nanimono2018-09-15 12:21 回复
        • # 手动运行下面两条命令,再试
          rm -rf /usr/local/mtproxy/proxy-secret
          wget --no-check-certificate -q  -O "/usr/local/mtproxy/proxy-secret" "https://core.telegram.org/getProxySecret"
          
          Toyo2018-09-15 14:32 回复
          • 搞定了,谢谢!
            Nanimono2018-09-15 18:24 回复
  17. 请楼主能不能帮忙吧ipv6协议写进去
    ooeewen2018-09-13 12:57 回复
    • 请去 Github 联系作者。
      Toyo2018-09-13 14:42 回复
1 2