美文网首页
搭一个 Telegram 代理

搭一个 Telegram 代理

作者: Lupino | 来源:发表于2020-11-17 21:59 被阅读0次

Telegram,在国内没办法直接使用,需要代理,于是就尝试的搭了一下。

Telegram 支持两种代理,Sock5 和 MTProxy

Sock5

sock5 相对比较简单,用 ssh 命令就可以搞定。

ssh -D 9050 -qTfNn root@youip

这样子出来的sock5 代理是没有 密码的,只要知道ip 和 端口就可以使用。

MTProxy

MTProxy 是 Telegram 自家研发的,需要自己编译。

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

编译后,二进制文件在 objs/bin 里面

cd objs/bin

获取配置文件

curl -s https://core.telegram.org/getProxySecret -o proxy-secret
curl -s https://core.telegram.org/getProxyConfig -o proxy-multi.conf

生成一个密钥

head -c 16 /dev/urandom | xxd -ps

最后运行起来

./mtproto-proxy -u nobody -p 8888 -H 443 -S <secret> --aes-pwd proxy-secret proxy-multi.conf -M 1

正常的版本在 ubuntu 上没法运行,打下补丁,重新编译,运行就可。

diff --git a/common/pid.c b/common/pid.c
index 7bd4b8d..b05472f 100644
--- a/common/pid.c
+++ b/common/pid.c
@@ -39,7 +39,7 @@ npid_t PID;
 void init_common_PID (void) {
   if (!PID.pid) {
     int p = getpid ();
-    assert (!(p & 0xffff0000));
+    // assert (!(p & 0xffff0000));
     PID.pid = p;
   }
   if (!PID.utime) {

相关文章

网友评论

      本文标题:搭一个 Telegram 代理

      本文链接:https://www.haomeiwen.com/subject/ilbfiktx.html