Giter Site home page Giter Site logo

mtg's Issues

Temporary unavailability on restart

Hey there,

After restarting the proxy it becomes unavailable for a couple of minutes. Telegram client app sees Connecting... and not a failed connection error. I should mention that my server does have connectivity with ipv6 telegram servers only, so I assume mtg tries to connect to ipv4 servers first, which can cause the problem.

Some time in the past mtg had MTG_USE_IPV6 environment variable option and everything was fine, btw.

Public IP detection is broken

IP [my ipv6] is not IPv4

Public IP detection is broken because DNS records of v4.ifconfig.co/v6.ifconfig.co both contains IPv4 and IPv6 addresses now:

$ host v4.ifconfig.co 1.1.1.1
Using domain server:
Name: 1.1.1.1
Address: 1.1.1.1#53
Aliases:

v4.ifconfig.co has address 104.28.3.88
v4.ifconfig.co has address 104.28.2.88
v4.ifconfig.co has IPv6 address 2400:cb00:2048:1::681c:358
v4.ifconfig.co has IPv6 address 2400:cb00:2048:1::681c:258
$ host v6.ifconfig.co 1.1.1.1
Using domain server:
Name: 1.1.1.1
Address: 1.1.1.1#53
Aliases:

v6.ifconfig.co has address 104.28.3.88
v6.ifconfig.co has address 104.28.2.88
v6.ifconfig.co has IPv6 address 2400:cb00:2048:1::681c:358
v6.ifconfig.co has IPv6 address 2400:cb00:2048:1::681c:25

"Cannot pump sockets" in log

Hello!
Works fine, but the stderr log is full of messages "Cannot pump sockets", "Cannot read stream ciphered data".
Run it under CentOS 7 without docker in secret only mode at VPS based in England (log in verbose mode). Tried both to download ready to run file at "Releases" and build it ("Master" branch) - issue exists in both cases.

{"level":"warn","ts":1551001510.551488,"logger":"conn.stream-cipher","msg":"Cannot pump sockets","connection_id":"60e8701b-0070-4acc-8d63-08c4084d7fd1","local_address":"185.133.192.131:2309","remote_address":"37.204.77.54:38868","purpose":"client","faked_local_addr":"185.133.192.131:2309","error":"Cannot read stream ciphered data: read tcp 185.133.192.131:2309->37.204.77.54:38868: i/o timeout","errorVerbose":"read tcp 185.133.192.131:2309->37.204.77.54:38868: i/o timeout\n/home/mtg_proto/mtg-master/wrappers/streamcipher.go:24: Cannot read stream ciphered data"}
{"level":"warn","ts":1551001510.5516129,"logger":"conn.stream-cipher","msg":"Cannot pump sockets","connection_id":"60e8701b-0070-4acc-8d63-08c4084d7fd1","local_address":"[2a06:8ec0:3::1:12d7]:22251","remote_address":"[2001:67c:4e8:f002::a]:443","purpose":"telegram","faked_local_addr":"[2a06:8ec0:3::1:12d7]:22251"
,"error":"Cannot read stream ciphered data: read tcp [2a06:8ec0:3::1:12d7]:22251->[2001:67c:4e8:f002::a]:443: use of closed network connection","errorVerbose
":"read tcp [2a06:8ec0:3::1:12d7]:22251->[2001:67c:4e8:f002::a]:443: use of closed network connection\n/home/mtg_proto/mtg-master/wrappers/streamcipher.go:24: Cannot read stream ciphered data"}
{"level":"warn","ts":1551001634.9258738,"logger":"conn.stream-cipher","msg":"Cannot pump sockets","connection_id":"b7cddd0d-371a-4fc8-a2e9-f7f997fe7bc5","local_address":"185.133.192.131:2309","remote_address":"37.204.77.54:38886","purpose":"client","faked_local_addr":"185.133.192.131:2309","error":"Cannot read stream ciphered data: read tcp 185.133.192.131:2309->37.204.77.54:38886: i/o timeout","errorVerbose":"read tcp 185.133.192.131:2309->37.204.77.54:38886: i/o timeout\n/home/mtg_proto/mtg-master/wrappers/streamcipher.go:24: Cannot read stream ciphered data"}
{"level":"warn","ts":1551001634.9259834,"logger":"conn.stream-cipher","msg":"Cannot pump sockets","connection_id":"b7cddd0d-371a-4fc8-a2e9-f7f997fe7bc5","local_address":"[2a06:8ec0:3::1:12d7]:26165","remote_address":"[2001:67c:4e8:f002::a]:443","purpose":"telegram","faked_local_addr":"[2a06:8ec0:3::1:12d7]:26165"
,"error":"Cannot read stream ciphered data: read tcp [2a06:8ec0:3::1:12d7]:26165->[2001:67c:4e8:f002::a]:443: use of closed network connection","errorVerbose
":"read tcp [2a06:8ec0:3::1:12d7]:26165->[2001:67c:4e8:f002::a]:443: use of closed network connection\n/home/mtg_proto/mtg-master/wrappers/streamcipher.go:24: Cannot read stream ciphered data"}
{"level":"warn","ts":1551001759.0788708,"logger":"conn.stream-cipher","msg":"Cannot pump sockets","connection_id":"04f00825-beaa-4b48-882a-fa3577ea412c","local_address":"185.133.192.131:2309","remote_address":"37.204.77.54:38894","purpose":"client","faked_local_addr":"185.133.192.131:2309","error":"Cannot read stream ciphered data: read tcp 185.133.192.131:2309->37.204.77.54:38894: i/o timeout","errorVerbose":"read tcp 185.133.192.131:2309->37.204.77.54:38894: i/o timeout\n/home/mtg_proto/mtg-master/wrappers/streamcipher.go:24: Cannot read stream ciphered data"}

adtag problems

Добрый день!
При попытке запуска в докере с указанием adtag в лог валится ошибка:
{"level":"error","ts":1549551762.0736535,"logger":"main","msg":"Cannot initialize server connection","connection_id":"0da214ef-e6db-40d9-a66c-f22152d2f272","error":"Cannot handshake telegram: Cannot read RPC handshake response: Cannot read frame padding: Cannot read from socket: EOF","errorVerbose":"EOF\ngithub.com/9seconds/mtg/wrappers/blockcipher.go:37: Cannot read from socket\ngithub.com/9seconds/mtg/wrappers/mtproto_frame.go:52: Cannot read frame padding\ngithub.com/9seconds/mtg/telegram/middle.go:100: Cannot read RPC handshake response\ngithub.com/9seconds/mtg/proxy/proxy.go:118: Cannot handshake telegram"}
Клиенты при этом не подключаются.
Запускать пытался вот так:
docker run --name mtg-latest --restart=unless-stopped -p 8888:3128 -p 3129:3129 -d nineseconds/mtg:latest -s <ddsecret> <adtag>
При запуске без adtag все прекрасно работает. Пробовал на stable и latest.
Может быть опять какие-то изменения в API, как этом issue?

Enforce secure mode

Seems like RKN now banning proxies based on protocol fingerprint.
Iran was fast at figuring it out: TelegramMessenger/MTProxy#35
Secure mode with random padding helps (at least for now)
Might be good idea to set secure mode by default and allow disabling it via ENV/config.

обновление с сохранением секрета

а как правильно докер обновлять, я каждый раз секрет везде переставляю, наверно можно как-то по феншую делать, а то если несколько устройств менять на каждом утомительно
запускаю я его в secure mode на 443 порту вот так:
docker run --name mtg --restart=always -p 443:443 -p 3129:3129 -d nineseconds/mtg:latest dd$(openssl rand -hex 16) --secure-only --public-ipv4 ххх.xxx.xxx.xxх --bind-port 443
где ххх - ip адрес vps'ки
в документации этот вопрос вроде не освещён

Config file

Hello, is it possible to implement config file support, so i can launch it with something like

mtg -c /etc/mtg.conf

Right now i'm using systemd with EnvironmentFile, it's kind of ok but not the cleanest way for sure.

Process dead

image
Centos 6.10
mtg -p 443 -b 0.0.0.0 ...
The process always dies, for no reason, and it will be like this in a while.

Multiple ports

Are there any ways to listen on multiple ports? If not, than let is be feature request.

--version reports incorrect version

FYI:

lex@tga-1 ⇣⇡ ❯ wget https://github.com/9seconds/mtg/releases/download/0.15/mtg-linux-amd64
lex@tga-1 ⇣⇡ ❯ chmod 0750 mtg-linux-amd64
lex@tga-1 ⇣⇡ ❯ ./mtg-linux-amd64 --version
0.12-14-gac33abb (go version go1.11.1 linux/amd64) [Wed, 10 Oct 2018 10:48:20 +0000]

Не подключается клиент при добавлении префикса dd

Добрый день!

mtg запущен вот так:
docker run --name mtg --restart=unless-stopped -p 8443:3128 -p 127.0.0.1:3129:3129 -d nineseconds/mtg -a 8443 <pass_here>

При добавлении в клиент префикса dd к ключу, клиент перестает соединяться с прокси. В чем может быть дело? Промежуточных прокси нет. Клиенты десктоп и мобильный, версии последние.

Согласно ридми это вррде бы(?) должно работать штатно.

Cannot start with adtag at all, without it works with some warns

Without adtag works but with erros in log:

{
  "level": "error",
  "ts": 1531255859.299111,
  "logger": "main",
  "msg": "Cannot initialize client connection",
  "connection_id": "57c86d29-b0a8-48d5-94cc-2c81482319b7",
  "error": "Cannot parse obfuscated frame: Unknown protocol: Unknown handshake protocol",
  "errorVerbose": "/home/vagrant/safe/go/src/github.com/9seconds/mtg/mtproto/connection_options.go:79: Unknown handshake protocol\n/home/vagrant/safe/go/src/github.com/9seconds/mtg/obfuscated2/obfuscated2.go:40: Unknown protocol\n/home/vagrant/safe/go/src/github.com/9seconds/mtg/client/direct.go:45: Cannot parse obfuscated frame"
}

With it can't connect at all:

{
  "level": "error",
  "ts": 1531256123.8771994,
  "logger": "main",
  "msg": "Cannot initialize server connection",
  "connection_id": "6f294179-cdfa-43b0-bcf4-d53e1c49eae2",
  "error": "Cannot handshake telegram: Cannot read RPC nonce response: Cannot read frame padding: EOF",
  "errorVerbose": "EOF\n/home/vagrant/safe/go/src/github.com/9seconds/mtg/wrappers/mtproto_frame.go:52: Cannot read frame padding\n/home/vagrant/safe/go/src/github.com/9seconds/mtg/telegram/middle.go:71: Cannot read RPC nonce response\n/home/vagrant/safe/go/src/github.com/9seconds/mtg/proxy/proxy.go:103: Cannot handshake telegram"
}

My VPS is under NAT so I provide port, local and public addressed. I use precompiled binary from Releases.

Constantly out of memory

I have experienced 3 out of memory error this day. My machine has 1GB memory and is dedicated to run this proxy. And I am the only user of it.

Parameter I used: -d -v -s

Log:

fatal error: runtime: out of memory

runtime stack:
runtime.throw(0x96f8dc, 0x16)
        /snap/go/2890/src/runtime/panic.go:608 +0x72
runtime.sysMap(0xc004000000, 0x68000000, 0xda7a38)
        /snap/go/2890/src/runtime/mem_linux.go:156 +0xc7
runtime.(*mheap).sysAlloc(0xd8e640, 0x68000000, 0x0, 0x0)
        /snap/go/2890/src/runtime/malloc.go:619 +0x1c7
runtime.(*mheap).grow(0xd8e640, 0x3393a, 0x0)
        /snap/go/2890/src/runtime/mheap.go:920 +0x42
runtime.(*mheap).allocSpanLocked(0xd8e640, 0x3393a, 0xda7a48, 0x0)
        /snap/go/2890/src/runtime/mheap.go:848 +0x337
runtime.(*mheap).alloc_m(0xd8e640, 0x3393a, 0xc000040101, 0xc000000001)
        /snap/go/2890/src/runtime/mheap.go:692 +0x119
runtime.(*mheap).alloc.func1()
        /snap/go/2890/src/runtime/mheap.go:759 +0x4c
runtime.(*mheap).alloc(0xd8e640, 0x3393a, 0xc000010101, 0x8a6600)
        /snap/go/2890/src/runtime/mheap.go:758 +0x8a
runtime.largeAlloc(0x672724d1, 0x101, 0x136)
        /snap/go/2890/src/runtime/malloc.go:1019 +0x97
runtime.mallocgc.func1()
        /snap/go/2890/src/runtime/malloc.go:914 +0x46
runtime.systemstack(0x0)
        /snap/go/2890/src/runtime/asm_amd64.s:351 +0x66
runtime.mstart()
        /snap/go/2890/src/runtime/proc.go:1229

goroutine 5482 [running]:
runtime.systemstack_switch()
        /snap/go/2890/src/runtime/asm_amd64.s:311 fp=0xc000201c08 sp=0xc000201c00 pc=0x457800
runtime.mallocgc(0x672724d1, 0x8a7d80, 0x1, 0xc000201ce0)
        /snap/go/2890/src/runtime/malloc.go:913 +0x896 fp=0xc000201ca8 sp=0xc000201c08 pc=0x40d9d6
runtime.makeslice(0x8a7d80, 0x672724d1, 0x672724d1, 0x4, 0x8, 0xc00045ae00)
        /snap/go/2890/src/runtime/slice.go:70 +0x77 fp=0xc000201cd8 sp=0xc000201ca8 pc=0x442947
bytes.makeSlice(0x672724d1, 0x0, 0x0, 0x0)
        /snap/go/2890/src/bytes/buffer.go:231 +0x6d fp=0xc000201d18 sp=0xc000201cd8 pc=0x46d19d
bytes.(*Buffer).grow(0xc00030bce0, 0x67271fd1, 0x8)
        /snap/go/2890/src/bytes/buffer.go:144 +0x15a fp=0xc000201d68 sp=0xc000201d18 pc=0x46cb0a
bytes.(*Buffer).Grow(0xc00030bce0, 0x67271fd1)
        /snap/go/2890/src/bytes/buffer.go:163 +0x3a fp=0xc000201d90 sp=0xc000201d68 pc=0x46ccba
github.com/9seconds/mtg/wrappers.(*MTProtoIntermediate).Read(0xc000135ec0, 0x0, 0x0, 0x0, 0x0, 0x0)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/wrappers/mtproto_intermediate.go:60 +0x43a
 fp=0xc000201ed0 sp=0xc000201d90 pc=0x846e5a
github.com/9seconds/mtg/wrappers.(*MTProtoIntermediateSecure).Read(0xc000135ec0, 0x9897d8, 0xc00024b
330, 0xc00009c900, 0xc00003ef68, 0xc00003ef68)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/wrappers/mtproto_intermediate_secure.go:19
 +0x31 fp=0xc000201f10 sp=0xc000201ed0 pc=0x847601
github.com/9seconds/mtg/proxy.(*Proxy).middlePipe(0xc00025e920, 0x7fc06d64e340, 0xc000135ec0, 0x7fc0
6d64e380, 0xc00013ed80, 0xc00024b330, 0xc000310da4)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/proxy/proxy.go:131 +0x83 fp=0xc000201fa8 s
p=0xc000201f10 pc=0x851d53
runtime.goexit()
        /snap/go/2890/src/runtime/asm_amd64.s:1333 +0x1 fp=0xc000201fb0 sp=0xc000201fa8 pc=0x4598e1
created by github.com/9seconds/mtg/proxy.(*Proxy).accept
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/proxy/proxy.go:95 +0x8f6

goroutine 1 [IO wait]:
internal/poll.runtime_pollWait(0x7fc06d635d60, 0x72, 0x0)
        /snap/go/2890/src/runtime/netpoll.go:173 +0x66
internal/poll.(*pollDesc).wait(0xc0000b9018, 0x72, 0xc00009c900, 0x0, 0x0)
        /snap/go/2890/src/internal/poll/fd_poll_runtime.go:85 +0x9a
internal/poll.(*pollDesc).waitRead(0xc0000b9018, 0xffffffffffffff00, 0x0, 0x0)
        /snap/go/2890/src/internal/poll/fd_poll_runtime.go:90 +0x3d
internal/poll.(*FD).Accept(0xc0000b9000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
        /snap/go/2890/src/internal/poll/fd_unix.go:384 +0x1a0
net.(*netFD).accept(0xc0000b9000, 0xc00000e288, 0x0, 0x0)
        /snap/go/2890/src/net/fd_unix.go:238 +0x42
net.(*TCPListener).accept(0xc0000982d8, 0xc0000cd9f0, 0xc0000cd9f8, 0x18)
        /snap/go/2890/src/net/tcpsock_posix.go:139 +0x2e
net.(*TCPListener).Accept(0xc0000982d8, 0x9880e0, 0xc00025e920, 0x9fcae0, 0xc00000e288)
        /snap/go/2890/src/net/tcpsock.go:260 +0x47
github.com/9seconds/mtg/proxy.(*Proxy).Serve(0xc00025e920, 0xc00025e920, 0x0)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/proxy/proxy.go:36 +0xae
main.main()
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/main.go:208 +0x9a7

goroutine 38 [select]:
github.com/9seconds/mtg/stats.(*Stats).start(0xc000020800)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/stats/stats.go:108 +0x156
created by github.com/9seconds/mtg/stats.Init
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/stats/init.go:24 +0xe8

goroutine 39 [IO wait, 386 minutes]:
internal/poll.runtime_pollWait(0x7fc06d635f00, 0x72, 0x0)
        /snap/go/2890/src/runtime/netpoll.go:173 +0x66
internal/poll.(*pollDesc).wait(0xc0000b8a18, 0x72, 0xc000062200, 0x0, 0x0)
        /snap/go/2890/src/internal/poll/fd_poll_runtime.go:85 +0x9a
internal/poll.(*pollDesc).waitRead(0xc0000b8a18, 0xffffffffffffff00, 0x0, 0x0)
        /snap/go/2890/src/internal/poll/fd_poll_runtime.go:90 +0x3d
internal/poll.(*FD).Accept(0xc0000b8a00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
        /snap/go/2890/src/internal/poll/fd_unix.go:384 +0x1a0
net.(*netFD).accept(0xc0000b8a00, 0xd89120, 0x30, 0x30)
        /snap/go/2890/src/net/fd_unix.go:238 +0x42
net.(*TCPListener).accept(0xc000098280, 0x50, 0x7fc06d691000, 0x0)
        /snap/go/2890/src/net/tcpsock_posix.go:139 +0x2e
net.(*TCPListener).AcceptTCP(0xc000098280, 0x40dcb8, 0x30, 0x9250a0)
        /snap/go/2890/src/net/tcpsock.go:247 +0x47
net/http.tcpKeepAliveListener.Accept(0xc000098280, 0x9250a0, 0xc000135b60, 0x8cd520, 0xd79e40)
        /snap/go/2890/src/net/http/server.go:3232 +0x2f
net/http.(*Server).Serve(0xc0004360d0, 0x9f9ca0, 0xc000098280, 0x0, 0x0)
        /snap/go/2890/src/net/http/server.go:2826 +0x22f
net/http.(*Server).ListenAndServe(0xc0004360d0, 0xc0004360d0, 0xe)
        /snap/go/2890/src/net/http/server.go:2764 +0xb6
net/http.ListenAndServe(0xc000454970, 0xe, 0x0, 0x0, 0x0, 0x0)
        /snap/go/2890/src/net/http/server.go:3004 +0x74
github.com/9seconds/mtg/stats.startServer(0xc00011e690, 0x9f4c20, 0xc0004c05a0)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/stats/server.go:37 +0xf8
created by github.com/9seconds/mtg/stats.Init
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/stats/init.go:25 +0x12c

goroutine 37 [chan receive]:
github.com/9seconds/mtg/stats.(*prometheusExporter).run(0xc0002b8380)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/stats/prometheus.go:26 +0xb8
created by github.com/9seconds/mtg/stats.Init
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/stats/init.go:22 +0xb8

goroutine 15 [chan receive]:
github.com/9seconds/mtg/ntp.AutoUpdate()
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/ntp/ntp.go:42 +0xac
created by main.main
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/main.go:197 +0x964

goroutine 50 [chan receive, 26 minutes]:
github.com/9seconds/mtg/telegram.(*middleTelegramCaller).autoUpdate(0xc0000d8790)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/telegram/middle_caller.go:55 +0x77
created by github.com/9seconds/mtg/telegram.NewMiddleTelegram
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/telegram/middle.go:136 +0x10a

goroutine 5452 [IO wait, 1 minutes]:
internal/poll.runtime_pollWait(0x7fc06d655538, 0x72, 0xc00018d988)
        /snap/go/2890/src/runtime/netpoll.go:173 +0x66
internal/poll.(*pollDesc).wait(0xc0003a4c18, 0x72, 0xffffffffffffff00, 0x9f50e0, 0xd4c6a0)
        /snap/go/2890/src/internal/poll/fd_poll_runtime.go:85 +0x9a
internal/poll.(*pollDesc).waitRead(0xc0003a4c18, 0xc000518500, 0x4, 0x280)
        /snap/go/2890/src/internal/poll/fd_poll_runtime.go:90 +0x3d
internal/poll.(*FD).Read(0xc0003a4c00, 0xc000518500, 0x4, 0x280, 0x0, 0x0, 0x0)
        /snap/go/2890/src/internal/poll/fd_unix.go:169 +0x179
net.(*netFD).Read(0xc0003a4c00, 0xc000518500, 0x4, 0x280, 0x1520d391c7b8, 0xd88520, 0x0)
        /snap/go/2890/src/net/fd_unix.go:202 +0x4f
net.(*conn).Read(0xc00000e240, 0xc000518500, 0x4, 0x280, 0x0, 0x0, 0x0)
        /snap/go/2890/src/net/net.go:177 +0x68
github.com/9seconds/mtg/wrappers.(*Conn).Read(0xc0000b48c0, 0xc000518500, 0x4, 0x280, 0xc000518500,
0x280, 0x280)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/wrappers/conn.go:87 +0x107
github.com/9seconds/mtg/wrappers.(*StreamCipher).Read(0xc0002f0b40, 0xc000518500, 0x4, 0x280, 0x280,
 0x280, 0xc000518500)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/wrappers/streamcipher.go:22 +0x56
io.(*LimitedReader).Read(0xc000250d60, 0xc000518500, 0x280, 0x280, 0x0, 0x203000, 0xc00018dc68)
        /snap/go/2890/src/io/io.go:448 +0x63
bytes.(*Buffer).ReadFrom(0xc0005005b0, 0x9f3ba0, 0xc000250d60, 0x7fc06d64e158, 0xc0005005b0, 0x1)
        /snap/go/2890/src/bytes/buffer.go:206 +0xb4
io.copyBuffer(0x9f3760, 0xc0005005b0, 0x9f3ba0, 0xc000250d60, 0x0, 0x0, 0x0, 0x8f9980, 0x7fc06d64e40
1, 0xc000250d60)
        /snap/go/2890/src/io/io.go:388 +0x303
io.Copy(0x9f3760, 0xc0005005b0, 0x9f3ba0, 0xc000250d60, 0x9068e0, 0x0, 0x7fc06d64e440)
        /snap/go/2890/src/io/io.go:364 +0x5a
io.CopyN(0x9f3760, 0xc0005005b0, 0x7fc06d64e440, 0xc0002f0b40, 0x4, 0x6, 0x0, 0x0)
        /snap/go/2890/src/io/io.go:340 +0x86
github.com/9seconds/mtg/wrappers.(*MTProtoIntermediate).Read(0xc00013e360, 0x0, 0x0, 0x0, 0x0, 0x0)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/wrappers/mtproto_intermediate.go:42 +0x222
github.com/9seconds/mtg/wrappers.(*MTProtoIntermediateSecure).Read(0xc00013e360, 0xc000153100, 0xfc,
 0x700, 0xfc, 0x0)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/wrappers/mtproto_intermediate_secure.go:19
 +0x31
github.com/9seconds/mtg/proxy.(*Proxy).middlePipe(0xc00025e920, 0x7fc06d64e340, 0xc00013e360, 0x7fc0
6d64e380, 0xc00013e450, 0xc00024aa60, 0xc0000289f4)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/proxy/proxy.go:131 +0x83
created by github.com/9seconds/mtg/proxy.(*Proxy).accept
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/proxy/proxy.go:95 +0x8f6

goroutine 5481 [chan receive]:
github.com/9seconds/mtg/proxy.(*Proxy).accept.func2(0x9fa0a0, 0xc00009ca80, 0x7fc06d64e2f0, 0xc00013
ed80, 0x7fc06d5fa5c8, 0xc000135ec0)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/proxy/proxy.go:84 +0x4c
created by github.com/9seconds/mtg/proxy.(*Proxy).accept
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/proxy/proxy.go:83 +0x74f

goroutine 5451 [chan receive, 1 minutes]:
github.com/9seconds/mtg/proxy.(*Proxy).accept.func2(0x9fa0a0, 0xc0002f0a80, 0x7fc06d64e2f0, 0xc00013
e450, 0x7fc06d5fa5c8, 0xc00013e360)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/proxy/proxy.go:84 +0x4c
created by github.com/9seconds/mtg/proxy.(*Proxy).accept
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/proxy/proxy.go:83 +0x74f

goroutine 5459 [IO wait]:
internal/poll.runtime_pollWait(0x7fc06d655398, 0x72, 0xc0000e7528)
        /snap/go/2890/src/runtime/netpoll.go:173 +0x66
internal/poll.(*pollDesc).wait(0xc0003a4418, 0x72, 0xffffffffffffff00, 0x9f50e0, 0xd4c6a0)
        /snap/go/2890/src/internal/poll/fd_poll_runtime.go:85 +0x9a
internal/poll.(*pollDesc).waitRead(0xc0003a4418, 0xc00055d200, 0x401, 0x401)
        /snap/go/2890/src/internal/poll/fd_poll_runtime.go:90 +0x3d
internal/poll.(*FD).Read(0xc0003a4400, 0xc00055d200, 0x401, 0x401, 0x0, 0x0, 0x0)
        /snap/go/2890/src/internal/poll/fd_unix.go:169 +0x179
net.(*netFD).Read(0xc0003a4400, 0xc00055d200, 0x401, 0x401, 0x153113678837, 0xd88520, 0x0)
        /snap/go/2890/src/net/fd_unix.go:202 +0x4f
net.(*conn).Read(0xc000098018, 0xc00055d200, 0x401, 0x401, 0x0, 0x0, 0x0)
        /snap/go/2890/src/net/net.go:177 +0x68
github.com/9seconds/mtg/wrappers.(*Conn).Read(0xc000500ee0, 0xc00055d200, 0x401, 0x401, 0x401, 0x401
, 0x0)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/wrappers/conn.go:87 +0x107
github.com/9seconds/mtg/utils.ReadCurrentData(0x7fc06d64e2b0, 0xc000500ee0, 0xc000500ee0, 0x7fc06d64
e2b0, 0xc000500ee0, 0x0, 0x4)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/utils/read_current_data.go:13 +0x107
github.com/9seconds/mtg/wrappers.(*BlockCipher).Read(0xc00009c5c0, 0xc0004540ac, 0x4, 0x4, 0x8a7d80,
 0x1, 0xc0004540ac)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/wrappers/blockcipher.go:35 +0xf9
io.(*LimitedReader).Read(0xc0001c6240, 0xc0004540ac, 0x4, 0x4, 0x4, 0x4, 0x10)
        /snap/go/2890/src/io/io.go:448 +0x63
io.copyBuffer(0x9f3be0, 0xc0001c61e0, 0x9f3ba0, 0xc0001c6240, 0xc0004540ac, 0x4, 0x4, 0x8f9980, 0x7f
c06d5fa601, 0xc0001c6240)
        /snap/go/2890/src/io/io.go:402 +0x125
io.Copy(0x9f3be0, 0xc0001c61e0, 0x9f3ba0, 0xc0001c6240, 0x9176c0, 0x0, 0x7fc06d5fa678)
        /snap/go/2890/src/io/io.go:364 +0x5a
io.CopyN(0x9f3be0, 0xc0001c61e0, 0x7fc06d5fa678, 0xc00009c5c0, 0x4, 0x4, 0x1, 0x0)
        /snap/go/2890/src/io/io.go:340 +0x86
github.com/9seconds/mtg/wrappers.(*MTProtoFrame).Read(0xc00027abe0, 0x96a200, 0xb, 0xc0000e7c00, 0x6
, 0x6)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/wrappers/mtproto_frame.go:51 +0x192
github.com/9seconds/mtg/wrappers.(*MTProtoProxy).Read(0xc00013e420, 0x0, 0x0, 0x0, 0x0, 0x0)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/wrappers/mtproto_proxy.go:36 +0x1e6
github.com/9seconds/mtg/proxy.(*Proxy).middlePipe(0xc00025e920, 0x7fc06d64e3a0, 0xc00013e420, 0x7fc0
6d64e3e0, 0xc000134cf0, 0xc0002287f0, 0xc000310606)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/proxy/proxy.go:131 +0x83
github.com/9seconds/mtg/proxy.(*Proxy).accept(0xc00025e920, 0x9fcae0, 0xc00000e020)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/proxy/proxy.go:96 +0x9aa
created by github.com/9seconds/mtg/proxy.(*Proxy).Serve
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/proxy/proxy.go:39 +0x18e

goroutine 3494 [IO wait]:
internal/poll.runtime_pollWait(0x7fc06d635470, 0x72, 0xc000485988)
        /snap/go/2890/src/runtime/netpoll.go:173 +0x66
internal/poll.(*pollDesc).wait(0xc0003a4118, 0x72, 0xffffffffffffff00, 0x9f50e0, 0xd4c6a0)
        /snap/go/2890/src/internal/poll/fd_poll_runtime.go:85 +0x9a
internal/poll.(*pollDesc).waitRead(0xc0003a4118, 0xc00052ec00, 0x4, 0x280)
        /snap/go/2890/src/internal/poll/fd_poll_runtime.go:90 +0x3d
internal/poll.(*FD).Read(0xc0003a4100, 0xc00052ec80, 0x4, 0x280, 0x0, 0x0, 0x0)
        /snap/go/2890/src/internal/poll/fd_unix.go:169 +0x179
net.(*netFD).Read(0xc0003a4100, 0xc00052ec80, 0x4, 0x280, 0x152f92b58175, 0xd88520, 0x0)
        /snap/go/2890/src/net/fd_unix.go:202 +0x4f
net.(*conn).Read(0xc00000e018, 0xc00052ec80, 0x4, 0x280, 0x0, 0x0, 0x0)
        /snap/go/2890/src/net/net.go:177 +0x68
github.com/9seconds/mtg/wrappers.(*Conn).Read(0xc00030a0e0, 0xc00052ec80, 0x4, 0x280, 0xc00052ec80,
0x280, 0x280)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/wrappers/conn.go:87 +0x107
github.com/9seconds/mtg/wrappers.(*StreamCipher).Read(0xc00009c100, 0xc00052ec80, 0x4, 0x280, 0x280,
 0x280, 0xc00052ec80)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/wrappers/streamcipher.go:22 +0x56
io.(*LimitedReader).Read(0xc000215120, 0xc00052ec80, 0x280, 0x280, 0x0, 0x203000, 0xc000485c68)
        /snap/go/2890/src/io/io.go:448 +0x63
bytes.(*Buffer).ReadFrom(0xc0000d6380, 0x9f3ba0, 0xc000215120, 0x7fc06d64e158, 0xc0000d6380, 0x1)
        /snap/go/2890/src/bytes/buffer.go:206 +0xb4
io.copyBuffer(0x9f3760, 0xc0000d6380, 0x9f3ba0, 0xc000215120, 0x0, 0x0, 0x0, 0x8f9980, 0x7fc06d64e40
1, 0xc000215120)
        /snap/go/2890/src/io/io.go:388 +0x303
io.Copy(0x9f3760, 0xc0000d6380, 0x9f3ba0, 0xc000215120, 0x9068e0, 0x0, 0x7fc06d64e440)
        /snap/go/2890/src/io/io.go:364 +0x5a
io.CopyN(0x9f3760, 0xc0000d6380, 0x7fc06d64e440, 0xc00009c100, 0x4, 0x6, 0x0, 0x0)
        /snap/go/2890/src/io/io.go:340 +0x86
github.com/9seconds/mtg/wrappers.(*MTProtoIntermediate).Read(0xc000083f50, 0x0, 0x0, 0x0, 0x0, 0x0)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/wrappers/mtproto_intermediate.go:42 +0x222
github.com/9seconds/mtg/wrappers.(*MTProtoIntermediateSecure).Read(0xc000083f50, 0xc000332300, 0xb4,
 0x700, 0xb4, 0x0)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/wrappers/mtproto_intermediate_secure.go:19
 +0x31
github.com/9seconds/mtg/proxy.(*Proxy).middlePipe(0xc00025e920, 0x7fc06d64e340, 0xc000083f50, 0x7fc0
6d64e380, 0xc000134690, 0xc00028c230, 0xc000310664)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/proxy/proxy.go:131 +0x83
created by github.com/9seconds/mtg/proxy.(*Proxy).accept
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/proxy/proxy.go:95 +0x8f6

goroutine 5439 [chan receive]:
github.com/9seconds/mtg/proxy.(*Proxy).accept.func2(0x9fa0a0, 0xc0002f0940, 0x7fc06d64e2f0, 0xc00013
e5a0, 0x7fc06d5fa5c8, 0xc00013e2a0)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/proxy/proxy.go:84 +0x4c
created by github.com/9seconds/mtg/proxy.(*Proxy).accept
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/proxy/proxy.go:83 +0x74f

goroutine 5465 [IO wait]:
internal/poll.runtime_pollWait(0x7fc06d5fe5e8, 0x72, 0xc000205528)
        /snap/go/2890/src/runtime/netpoll.go:173 +0x66
internal/poll.(*pollDesc).wait(0xc0003a4b98, 0x72, 0xffffffffffffff00, 0x9f50e0, 0xd4c6a0)
        /snap/go/2890/src/internal/poll/fd_poll_runtime.go:85 +0x9a
internal/poll.(*pollDesc).waitRead(0xc0003a4b98, 0xc00045e900, 0x401, 0x401)
        /snap/go/2890/src/internal/poll/fd_poll_runtime.go:90 +0x3d
internal/poll.(*FD).Read(0xc0003a4b80, 0xc00045e900, 0x401, 0x401, 0x0, 0x0, 0x0)
        /snap/go/2890/src/internal/poll/fd_unix.go:169 +0x179
net.(*netFD).Read(0xc0003a4b80, 0xc00045e900, 0x401, 0x401, 0x1531332f04bc, 0xd88520, 0x0)
        /snap/go/2890/src/net/fd_unix.go:202 +0x4f
net.(*conn).Read(0xc0000982c8, 0xc00045e900, 0x401, 0x401, 0x0, 0x0, 0x0)
        /snap/go/2890/src/net/net.go:177 +0x68
github.com/9seconds/mtg/wrappers.(*Conn).Read(0xc00030b9d0, 0xc00045e900, 0x401, 0x401, 0x401, 0x401
, 0xc000000000)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/wrappers/conn.go:87 +0x107
github.com/9seconds/mtg/utils.ReadCurrentData(0x7fc06d64e2b0, 0xc00030b9d0, 0xc00030b9d0, 0x7fc06d64
e2b0, 0xc00030b9d0, 0x0, 0x4)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/utils/read_current_data.go:13 +0x107
github.com/9seconds/mtg/wrappers.(*BlockCipher).Read(0xc00009cbc0, 0xc00024b340, 0x4, 0x4, 0x8a7d80,
 0x1, 0xc00024b340)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/wrappers/blockcipher.go:35 +0xf9
io.(*LimitedReader).Read(0xc00025f760, 0xc00024b340, 0x4, 0x4, 0x4, 0x4, 0x10)
        /snap/go/2890/src/io/io.go:448 +0x63
io.copyBuffer(0x9f3be0, 0xc00025f720, 0x9f3ba0, 0xc00025f760, 0xc00024b340, 0x4, 0x4, 0x8f9980, 0x7f
c06d5fa601, 0xc00025f760)
        /snap/go/2890/src/io/io.go:402 +0x125
io.Copy(0x9f3be0, 0xc00025f720, 0x9f3ba0, 0xc00025f760, 0x9176c0, 0x0, 0x7fc06d5fa678)
        /snap/go/2890/src/io/io.go:364 +0x5a
io.CopyN(0x9f3be0, 0xc00025f720, 0x7fc06d5fa678, 0xc00009cbc0, 0x4, 0x4, 0x1, 0x0)
        /snap/go/2890/src/io/io.go:340 +0x86
github.com/9seconds/mtg/wrappers.(*MTProtoFrame).Read(0xc0001c6340, 0x96a200, 0xb, 0xc000205c00, 0x6
, 0x6)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/wrappers/mtproto_frame.go:51 +0x192
github.com/9seconds/mtg/wrappers.(*MTProtoProxy).Read(0xc00013ed80, 0x0, 0x0, 0x0, 0x0, 0x0)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/wrappers/mtproto_proxy.go:36 +0x1e6
github.com/9seconds/mtg/proxy.(*Proxy).middlePipe(0xc00025e920, 0x7fc06d64e3a0, 0xc00013ed80, 0x7fc0
6d64e3e0, 0xc000135ec0, 0xc00024b330, 0xc000310da6)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/proxy/proxy.go:131 +0x83
github.com/9seconds/mtg/proxy.(*Proxy).accept(0xc00025e920, 0x9fcae0, 0xc00000e288)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/proxy/proxy.go:96 +0x9aa
created by github.com/9seconds/mtg/proxy.(*Proxy).Serve
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/proxy/proxy.go:39 +0x18e

goroutine 5453 [IO wait]:
internal/poll.runtime_pollWait(0x7fc06d5fee08, 0x72, 0xc0004c9528)
        /snap/go/2890/src/runtime/netpoll.go:173 +0x66
internal/poll.(*pollDesc).wait(0xc0000b8398, 0x72, 0xffffffffffffff00, 0x9f50e0, 0xd4c6a0)
        /snap/go/2890/src/internal/poll/fd_poll_runtime.go:85 +0x9a
internal/poll.(*pollDesc).waitRead(0xc0000b8398, 0xc00055cd00, 0x401, 0x401)
        /snap/go/2890/src/internal/poll/fd_poll_runtime.go:90 +0x3d
internal/poll.(*FD).Read(0xc0000b8380, 0xc00055cd80, 0x401, 0x401, 0x0, 0x0, 0x0)
        /snap/go/2890/src/internal/poll/fd_unix.go:169 +0x179
net.(*netFD).Read(0xc0000b8380, 0xc00055cd80, 0x401, 0x401, 0x153112b55642, 0xd88520, 0x0)
        /snap/go/2890/src/net/fd_unix.go:202 +0x4f
net.(*conn).Read(0xc000098178, 0xc00055cd80, 0x401, 0x401, 0x0, 0x0, 0x0)
        /snap/go/2890/src/net/net.go:177 +0x68
github.com/9seconds/mtg/wrappers.(*Conn).Read(0xc000513e30, 0xc00055cd80, 0x401, 0x401, 0x401, 0x401
, 0x400)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/wrappers/conn.go:87 +0x107
github.com/9seconds/mtg/utils.ReadCurrentData(0x7fc06d64e2b0, 0xc000513e30, 0xc000513e30, 0x7fc06d64
e2b0, 0xc000513e30, 0x203000, 0x4)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/utils/read_current_data.go:13 +0x107
github.com/9seconds/mtg/wrappers.(*BlockCipher).Read(0xc0002f0980, 0xc00045401c, 0x4, 0x4, 0x8a7d80,
 0x1, 0xc00045401c)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/wrappers/blockcipher.go:35 +0xf9
io.(*LimitedReader).Read(0xc0001c6160, 0xc00045401c, 0x4, 0x4, 0x4, 0x4, 0x10)
        /snap/go/2890/src/io/io.go:448 +0x63
io.copyBuffer(0x9f3be0, 0xc0001c6140, 0x9f3ba0, 0xc0001c6160, 0xc00045401c, 0x4, 0x4, 0x8f9980, 0x7f
c06d5fa601, 0xc0001c6160)
        /snap/go/2890/src/io/io.go:402 +0x125
io.Copy(0x9f3be0, 0xc0001c6140, 0x9f3ba0, 0xc0001c6160, 0x9176c0, 0xc0001c6100, 0x7fc06d5fa678)
        /snap/go/2890/src/io/io.go:364 +0x5a
io.CopyN(0x9f3be0, 0xc0001c6140, 0x7fc06d5fa678, 0xc0002f0980, 0x4, 0xc000163980, 0x3, 0x6)
        /snap/go/2890/src/io/io.go:340 +0x86
github.com/9seconds/mtg/wrappers.(*MTProtoFrame).Read(0xc00025f420, 0x96a200, 0xb, 0xc0004c9c00, 0x6
, 0x6)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/wrappers/mtproto_frame.go:51 +0x192
github.com/9seconds/mtg/wrappers.(*MTProtoProxy).Read(0xc00013e5a0, 0x0, 0x0, 0x0, 0x0, 0x0)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/wrappers/mtproto_proxy.go:36 +0x1e6
github.com/9seconds/mtg/proxy.(*Proxy).middlePipe(0xc00025e920, 0x7fc06d64e3a0, 0xc00013e5a0, 0x7fc0
6d64e3e0, 0xc00013e2a0, 0xc00028d140, 0xc000310d36)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/proxy/proxy.go:131 +0x83
github.com/9seconds/mtg/proxy.(*Proxy).accept(0xc00025e920, 0x9fcae0, 0xc00000e028)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/proxy/proxy.go:96 +0x9aa
created by github.com/9seconds/mtg/proxy.(*Proxy).Serve
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/proxy/proxy.go:39 +0x18e

goroutine 3486 [IO wait]:
internal/poll.runtime_pollWait(0x7fc06d635a20, 0x72, 0xc000489528)
        /snap/go/2890/src/runtime/netpoll.go:173 +0x66
internal/poll.(*pollDesc).wait(0xc0003a4398, 0x72, 0xffffffffffffff00, 0x9f50e0, 0xd4c6a0)
        /snap/go/2890/src/internal/poll/fd_poll_runtime.go:85 +0x9a
internal/poll.(*pollDesc).waitRead(0xc0003a4398, 0xc000590400, 0x401, 0x401)
        /snap/go/2890/src/internal/poll/fd_poll_runtime.go:90 +0x3d
internal/poll.(*FD).Read(0xc0003a4380, 0xc000590480, 0x401, 0x401, 0x0, 0x0, 0x0)
        /snap/go/2890/src/internal/poll/fd_unix.go:169 +0x179
net.(*netFD).Read(0xc0003a4380, 0xc000590480, 0x401, 0x401, 0x152f812aa913, 0xd88520, 0x0)
        /snap/go/2890/src/net/fd_unix.go:202 +0x4f
net.(*conn).Read(0xc000098028, 0xc000590480, 0x401, 0x401, 0x0, 0x0, 0x0)
        /snap/go/2890/src/net/net.go:177 +0x68
github.com/9seconds/mtg/wrappers.(*Conn).Read(0xc0000b4000, 0xc000590480, 0x401, 0x401, 0x401, 0x401
, 0x400)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/wrappers/conn.go:87 +0x107
github.com/9seconds/mtg/utils.ReadCurrentData(0x7fc06d64e2b0, 0xc0000b4000, 0xc0000b4000, 0x7fc06d64
e2b0, 0xc0000b4000, 0x203000, 0x4)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/utils/read_current_data.go:13 +0x107
github.com/9seconds/mtg/wrappers.(*BlockCipher).Read(0xc00009c240, 0xc000228c1c, 0x4, 0x4, 0x8a7d80,
 0x1, 0xc000228c1c)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/wrappers/blockcipher.go:35 +0xf9
io.(*LimitedReader).Read(0xc000214ec0, 0xc000228c1c, 0x4, 0x4, 0x4, 0x4, 0x10)
        /snap/go/2890/src/io/io.go:448 +0x63
io.copyBuffer(0x9f3be0, 0xc000214ea0, 0x9f3ba0, 0xc000214ec0, 0xc000228c1c, 0x4, 0x4, 0x8f9980, 0x7f
c06d5fa601, 0xc000214ec0)
        /snap/go/2890/src/io/io.go:402 +0x125
io.Copy(0x9f3be0, 0xc000214ea0, 0x9f3ba0, 0xc000214ec0, 0x9176c0, 0xc000214e00, 0x7fc06d5fa678)
        /snap/go/2890/src/io/io.go:364 +0x5a
io.CopyN(0x9f3be0, 0xc000214ea0, 0x7fc06d5fa678, 0xc00009c240, 0x4, 0xc000312480, 0x3, 0x6)
        /snap/go/2890/src/io/io.go:340 +0x86
github.com/9seconds/mtg/wrappers.(*MTProtoFrame).Read(0xc000250200, 0x96a200, 0xb, 0xc000489c00, 0x6
, 0x6)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/wrappers/mtproto_frame.go:51 +0x192
github.com/9seconds/mtg/wrappers.(*MTProtoProxy).Read(0xc000134690, 0x0, 0x0, 0x0, 0x0, 0x0)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/wrappers/mtproto_proxy.go:36 +0x1e6
github.com/9seconds/mtg/proxy.(*Proxy).middlePipe(0xc00025e920, 0x7fc06d64e3a0, 0xc000134690, 0x7fc0
6d64e3e0, 0xc000083f50, 0xc00028c230, 0xc000310666)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/proxy/proxy.go:131 +0x83
github.com/9seconds/mtg/proxy.(*Proxy).accept(0xc00025e920, 0x9fcae0, 0xc00000e018)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/proxy/proxy.go:96 +0x9aa
created by github.com/9seconds/mtg/proxy.(*Proxy).Serve
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/proxy/proxy.go:39 +0x18e

goroutine 5476 [IO wait]:
internal/poll.runtime_pollWait(0x7fc06d5fe928, 0x72, 0xc0000e3988)
        /snap/go/2890/src/runtime/netpoll.go:173 +0x66
internal/poll.(*pollDesc).wait(0xc0003a4018, 0x72, 0xffffffffffffff00, 0x9f50e0, 0xd4c6a0)
        /snap/go/2890/src/internal/poll/fd_poll_runtime.go:85 +0x9a
internal/poll.(*pollDesc).waitRead(0xc0003a4018, 0xc0005b0200, 0x4, 0x280)
        /snap/go/2890/src/internal/poll/fd_poll_runtime.go:90 +0x3d
internal/poll.(*FD).Read(0xc0003a4000, 0xc0005b0280, 0x4, 0x280, 0x0, 0x0, 0x0)
        /snap/go/2890/src/internal/poll/fd_unix.go:169 +0x179
net.(*netFD).Read(0xc0003a4000, 0xc0005b0280, 0x4, 0x280, 0x1530ecdedc3c, 0xd88520, 0x0)
        /snap/go/2890/src/net/fd_unix.go:202 +0x4f
net.(*conn).Read(0xc00000e020, 0xc0005b0280, 0x4, 0x280, 0x0, 0x0, 0x0)
        /snap/go/2890/src/net/net.go:177 +0x68
github.com/9seconds/mtg/wrappers.(*Conn).Read(0xc0000b5340, 0xc0005b0280, 0x4, 0x280, 0xc0005b0280,
0x280, 0x280)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/wrappers/conn.go:87 +0x107
github.com/9seconds/mtg/wrappers.(*StreamCipher).Read(0xc00009c280, 0xc0005b0280, 0x4, 0x280, 0x280,
 0x280, 0xc0005b0280)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/wrappers/streamcipher.go:22 +0x56
io.(*LimitedReader).Read(0xc00027be40, 0xc0005b0280, 0x280, 0x280, 0x0, 0x203000, 0xc0000e3c68)
        /snap/go/2890/src/io/io.go:448 +0x63
bytes.(*Buffer).ReadFrom(0xc000512f50, 0x9f3ba0, 0xc00027be40, 0x7fc06d64e158, 0xc000512f50, 0x1)
        /snap/go/2890/src/bytes/buffer.go:206 +0xb4
io.copyBuffer(0x9f3760, 0xc000512f50, 0x9f3ba0, 0xc00027be40, 0x0, 0x0, 0x0, 0x8f9980, 0x7fc06d64e40
1, 0xc00027be40)
        /snap/go/2890/src/io/io.go:388 +0x303
io.Copy(0x9f3760, 0xc000512f50, 0x9f3ba0, 0xc00027be40, 0x9068e0, 0x0, 0x7fc06d64e440)
        /snap/go/2890/src/io/io.go:364 +0x5a
io.CopyN(0x9f3760, 0xc000512f50, 0x7fc06d64e440, 0xc00009c280, 0x4, 0x6, 0x0, 0x0)
        /snap/go/2890/src/io/io.go:340 +0x86
github.com/9seconds/mtg/wrappers.(*MTProtoIntermediate).Read(0xc000134cf0, 0x0, 0x0, 0x0, 0x0, 0x0)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/wrappers/mtproto_intermediate.go:42 +0x222
github.com/9seconds/mtg/wrappers.(*MTProtoIntermediateSecure).Read(0xc000134cf0, 0xc000558700, 0x1a4
, 0x700, 0x1a4, 0x0)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/wrappers/mtproto_intermediate_secure.go:19
 +0x31
github.com/9seconds/mtg/proxy.(*Proxy).middlePipe(0xc00025e920, 0x7fc06d64e340, 0xc000134cf0, 0x7fc0
6d64e380, 0xc00013e420, 0xc0002287f0, 0xc000310604)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/proxy/proxy.go:131 +0x83
created by github.com/9seconds/mtg/proxy.(*Proxy).accept
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/proxy/proxy.go:95 +0x8f6

goroutine 3493 [chan receive, 91 minutes]:
github.com/9seconds/mtg/proxy.(*Proxy).accept.func2(0x9fa0a0, 0xc00009c0c0, 0x7fc06d64e2f0, 0xc00013
4690, 0x7fc06d5fa5c8, 0xc000083f50)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/proxy/proxy.go:84 +0x4c
created by github.com/9seconds/mtg/proxy.(*Proxy).accept
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/proxy/proxy.go:83 +0x74f

goroutine 5440 [IO wait]:
internal/poll.runtime_pollWait(0x7fc06d5fe6b8, 0x72, 0xc0004c5988)
        /snap/go/2890/src/runtime/netpoll.go:173 +0x66
internal/poll.(*pollDesc).wait(0xc0003a4218, 0x72, 0xffffffffffffff00, 0x9f50e0, 0xd4c6a0)
        /snap/go/2890/src/internal/poll/fd_poll_runtime.go:85 +0x9a
internal/poll.(*pollDesc).waitRead(0xc0003a4218, 0xc0005b0000, 0x4, 0x280)
        /snap/go/2890/src/internal/poll/fd_poll_runtime.go:90 +0x3d
internal/poll.(*FD).Read(0xc0003a4200, 0xc0005b0000, 0x4, 0x280, 0x0, 0x0, 0x0)
        /snap/go/2890/src/internal/poll/fd_unix.go:169 +0x179
net.(*netFD).Read(0xc0003a4200, 0xc0005b0000, 0x4, 0x280, 0x1530ec2a178f, 0xd88520, 0x0)
        /snap/go/2890/src/net/fd_unix.go:202 +0x4f
net.(*conn).Read(0xc00000e028, 0xc0005b0000, 0x4, 0x280, 0x0, 0x0, 0x0)
        /snap/go/2890/src/net/net.go:177 +0x68
github.com/9seconds/mtg/wrappers.(*Conn).Read(0xc000513dc0, 0xc0005b0000, 0x4, 0x280, 0xc0005b0000,
0x280, 0x280)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/wrappers/conn.go:87 +0x107
github.com/9seconds/mtg/wrappers.(*StreamCipher).Read(0xc00009c9c0, 0xc0005b0000, 0x4, 0x280, 0x280,
 0x280, 0xc0005b0000)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/wrappers/streamcipher.go:22 +0x56
io.(*LimitedReader).Read(0xc00027bde0, 0xc0005b0000, 0x280, 0x280, 0x0, 0x203000, 0xc0004c5c68)
        /snap/go/2890/src/io/io.go:448 +0x63
bytes.(*Buffer).ReadFrom(0xc000512e00, 0x9f3ba0, 0xc00027bde0, 0x7fc06d64e158, 0xc000512e00, 0x1)
        /snap/go/2890/src/bytes/buffer.go:206 +0xb4
io.copyBuffer(0x9f3760, 0xc000512e00, 0x9f3ba0, 0xc00027bde0, 0x0, 0x0, 0x0, 0x8f9980, 0x7fc06d64e40
1, 0xc00027bde0)
        /snap/go/2890/src/io/io.go:388 +0x303
io.Copy(0x9f3760, 0xc000512e00, 0x9f3ba0, 0xc00027bde0, 0x9068e0, 0x0, 0x7fc06d64e440)
        /snap/go/2890/src/io/io.go:364 +0x5a
io.CopyN(0x9f3760, 0xc000512e00, 0x7fc06d64e440, 0xc00009c9c0, 0x4, 0x6, 0x0, 0x0)
        /snap/go/2890/src/io/io.go:340 +0x86
github.com/9seconds/mtg/wrappers.(*MTProtoIntermediate).Read(0xc00013e2a0, 0x0, 0x0, 0x0, 0x0, 0x0)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/wrappers/mtproto_intermediate.go:42 +0x222
github.com/9seconds/mtg/wrappers.(*MTProtoIntermediateSecure).Read(0xc00013e2a0, 0xc000558000, 0xf8,
 0x700, 0xf8, 0x0)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/wrappers/mtproto_intermediate_secure.go:19
 +0x31
github.com/9seconds/mtg/proxy.(*Proxy).middlePipe(0xc00025e920, 0x7fc06d64e340, 0xc00013e2a0, 0x7fc0
6d64e380, 0xc00013e5a0, 0xc00028d140, 0xc000310d34)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/proxy/proxy.go:131 +0x83
created by github.com/9seconds/mtg/proxy.(*Proxy).accept
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/proxy/proxy.go:95 +0x8f6

goroutine 5449 [IO wait, 1 minutes]:
internal/poll.runtime_pollWait(0x7fc06d655468, 0x72, 0xc000191528)
        /snap/go/2890/src/runtime/netpoll.go:173 +0x66
internal/poll.(*pollDesc).wait(0xc0003a4e98, 0x72, 0xffffffffffffff00, 0x9f50e0, 0xd4c6a0)
        /snap/go/2890/src/internal/poll/fd_poll_runtime.go:85 +0x9a
internal/poll.(*pollDesc).waitRead(0xc0003a4e98, 0xc0005bdb00, 0x401, 0x401)
        /snap/go/2890/src/internal/poll/fd_poll_runtime.go:90 +0x3d
internal/poll.(*FD).Read(0xc0003a4e80, 0xc0005bdb00, 0x401, 0x401, 0x0, 0x0, 0x0)
        /snap/go/2890/src/internal/poll/fd_unix.go:169 +0x179
net.(*netFD).Read(0xc0003a4e80, 0xc0005bdb00, 0x401, 0x401, 0x1520dd8bbd1f, 0xd88520, 0x0)
        /snap/go/2890/src/net/fd_unix.go:202 +0x4f
net.(*conn).Read(0xc000098220, 0xc0005bdb00, 0x401, 0x401, 0x0, 0x0, 0x0)
        /snap/go/2890/src/net/net.go:177 +0x68
github.com/9seconds/mtg/wrappers.(*Conn).Read(0xc000132f50, 0xc0005bdb00, 0x401, 0x401, 0x401, 0x401
, 0x0)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/wrappers/conn.go:87 +0x107
github.com/9seconds/mtg/utils.ReadCurrentData(0x7fc06d64e2b0, 0xc000132f50, 0xc000132f50, 0x7fc06d64
e2b0, 0xc000132f50, 0x0, 0x4)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/utils/read_current_data.go:13 +0x107
github.com/9seconds/mtg/wrappers.(*BlockCipher).Read(0xc00009ca00, 0xc00024ad40, 0x4, 0x4, 0x8a7d80,
 0x1, 0xc00024ad40)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/wrappers/blockcipher.go:35 +0xf9
io.(*LimitedReader).Read(0xc000251040, 0xc00024ad40, 0x4, 0x4, 0x4, 0x4, 0x10)
        /snap/go/2890/src/io/io.go:448 +0x63
io.copyBuffer(0x9f3be0, 0xc000251000, 0x9f3ba0, 0xc000251040, 0xc00024ad40, 0x4, 0x4, 0x8f9980, 0x7f
c06d5fa601, 0xc000251040)
        /snap/go/2890/src/io/io.go:402 +0x125
io.Copy(0x9f3be0, 0xc000251000, 0x9f3ba0, 0xc000251040, 0x9176c0, 0x0, 0x7fc06d5fa678)
        /snap/go/2890/src/io/io.go:364 +0x5a
io.CopyN(0x9f3be0, 0xc000251000, 0x7fc06d5fa678, 0xc00009ca00, 0x4, 0x4, 0x1, 0x0)
        /snap/go/2890/src/io/io.go:340 +0x86
github.com/9seconds/mtg/wrappers.(*MTProtoFrame).Read(0xc00025fca0, 0x96a200, 0xb, 0xc000191c00, 0x6
, 0x6)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/wrappers/mtproto_frame.go:51 +0x192
github.com/9seconds/mtg/wrappers.(*MTProtoProxy).Read(0xc00013e450, 0x0, 0x0, 0x0, 0x0, 0x0)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/wrappers/mtproto_proxy.go:36 +0x1e6
github.com/9seconds/mtg/proxy.(*Proxy).middlePipe(0xc00025e920, 0x7fc06d64e3a0, 0xc00013e450, 0x7fc0
6d64e3e0, 0xc00013e360, 0xc00024aa60, 0xc0000289f6)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/proxy/proxy.go:131 +0x83
github.com/9seconds/mtg/proxy.(*Proxy).accept(0xc00025e920, 0x9fcae0, 0xc00000e240)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/proxy/proxy.go:96 +0x9aa
created by github.com/9seconds/mtg/proxy.(*Proxy).Serve
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/proxy/proxy.go:39 +0x18e

goroutine 5421 [IO wait, 1 minutes]:
internal/poll.runtime_pollWait(0x7fc06d5fed38, 0x72, 0xc0005ef988)
        /snap/go/2890/src/runtime/netpoll.go:173 +0x66
internal/poll.(*pollDesc).wait(0xc0000b8018, 0x72, 0xffffffffffffff00, 0x9f50e0, 0xd4c6a0)
        /snap/go/2890/src/internal/poll/fd_poll_runtime.go:85 +0x9a
internal/poll.(*pollDesc).waitRead(0xc0000b8018, 0xc0002a3400, 0x4, 0x280)
        /snap/go/2890/src/internal/poll/fd_poll_runtime.go:90 +0x3d
internal/poll.(*FD).Read(0xc0000b8000, 0xc0002a3400, 0x4, 0x280, 0x0, 0x0, 0x0)
        /snap/go/2890/src/internal/poll/fd_unix.go:169 +0x179
net.(*netFD).Read(0xc0000b8000, 0xc0002a3400, 0x4, 0x280, 0x151a776a4e00, 0xd88520, 0x0)
        /snap/go/2890/src/net/fd_unix.go:202 +0x4f
net.(*conn).Read(0xc000098020, 0xc0002a3400, 0x4, 0x280, 0x0, 0x0, 0x0)
        /snap/go/2890/src/net/net.go:177 +0x68
github.com/9seconds/mtg/wrappers.(*Conn).Read(0xc0000d6a80, 0xc0002a3400, 0x4, 0x280, 0xc0002a3400,
0x280, 0x280)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/wrappers/conn.go:87 +0x107
github.com/9seconds/mtg/wrappers.(*StreamCipher).Read(0xc00009c180, 0xc0002a3400, 0x4, 0x280, 0x280,
 0x280, 0xc0002a3400)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/wrappers/streamcipher.go:22 +0x56
io.(*LimitedReader).Read(0xc000215360, 0xc0002a3400, 0x280, 0x280, 0x0, 0x203000, 0xc0005efc68)
        /snap/go/2890/src/io/io.go:448 +0x63
bytes.(*Buffer).ReadFrom(0xc0000d7110, 0x9f3ba0, 0xc000215360, 0x7fc06d64e158, 0xc0000d7110, 0x1)
        /snap/go/2890/src/bytes/buffer.go:206 +0xb4
io.copyBuffer(0x9f3760, 0xc0000d7110, 0x9f3ba0, 0xc000215360, 0x0, 0x0, 0x0, 0x8f9980, 0x7fc06d64e40
1, 0xc000215360)
        /snap/go/2890/src/io/io.go:388 +0x303
io.Copy(0x9f3760, 0xc0000d7110, 0x9f3ba0, 0xc000215360, 0x9068e0, 0x0, 0x7fc06d64e440)
        /snap/go/2890/src/io/io.go:364 +0x5a
io.CopyN(0x9f3760, 0xc0000d7110, 0x7fc06d64e440, 0xc00009c180, 0x4, 0x6, 0x0, 0x0)
        /snap/go/2890/src/io/io.go:340 +0x86
github.com/9seconds/mtg/wrappers.(*MTProtoIntermediate).Read(0xc000134b40, 0x0, 0x0, 0x0, 0x0, 0x0)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/wrappers/mtproto_intermediate.go:42 +0x222
github.com/9seconds/mtg/wrappers.(*MTProtoIntermediateSecure).Read(0xc000134b40, 0xc000205c00, 0x94,
 0x700, 0x94, 0x0)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/wrappers/mtproto_intermediate_secure.go:19
 +0x31
github.com/9seconds/mtg/proxy.(*Proxy).middlePipe(0xc00025e920, 0x7fc06d64e340, 0xc000134b40, 0x7fc0
6d64e380, 0xc000134f90, 0xc00028ce10, 0xc000310784)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/proxy/proxy.go:131 +0x83
created by github.com/9seconds/mtg/proxy.(*Proxy).accept
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/proxy/proxy.go:95 +0x8f6

goroutine 5418 [IO wait, 1 minutes]:
internal/poll.runtime_pollWait(0x7fc06d6353a0, 0x72, 0xc0005f3528)
        /snap/go/2890/src/runtime/netpoll.go:173 +0x66
internal/poll.(*pollDesc).wait(0xc0000b8298, 0x72, 0xffffffffffffff00, 0x9f50e0, 0xd4c6a0)
        /snap/go/2890/src/internal/poll/fd_poll_runtime.go:85 +0x9a
internal/poll.(*pollDesc).waitRead(0xc0000b8298, 0xc00012e400, 0x401, 0x401)
        /snap/go/2890/src/internal/poll/fd_poll_runtime.go:90 +0x3d
internal/poll.(*FD).Read(0xc0000b8280, 0xc00012e480, 0x401, 0x401, 0x0, 0x0, 0x0)
        /snap/go/2890/src/internal/poll/fd_unix.go:169 +0x179
net.(*netFD).Read(0xc0000b8280, 0xc00012e480, 0x401, 0x401, 0x151a81f5bcb6, 0xd88520, 0x0)
        /snap/go/2890/src/net/fd_unix.go:202 +0x4f
net.(*conn).Read(0xc00000e008, 0xc00012e480, 0x401, 0x401, 0x0, 0x0, 0x0)
        /snap/go/2890/src/net/net.go:177 +0x68
github.com/9seconds/mtg/wrappers.(*Conn).Read(0xc000128770, 0xc00012e480, 0x401, 0x401, 0x401, 0x401
, 0x0)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/wrappers/conn.go:87 +0x107
github.com/9seconds/mtg/utils.ReadCurrentData(0x7fc06d64e2b0, 0xc000128770, 0xc000128770, 0x7fc06d64
e2b0, 0xc000128770, 0x0, 0x4)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/utils/read_current_data.go:13 +0x107
github.com/9seconds/mtg/wrappers.(*BlockCipher).Read(0xc0002f0900, 0xc000229330, 0x4, 0x4, 0x8a7d80,
 0x1, 0xc000229330)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/wrappers/blockcipher.go:35 +0xf9
io.(*LimitedReader).Read(0xc0002513c0, 0xc000229330, 0x4, 0x4, 0x4, 0x4, 0x10)
        /snap/go/2890/src/io/io.go:448 +0x63
io.copyBuffer(0x9f3be0, 0xc000251340, 0x9f3ba0, 0xc0002513c0, 0xc000229330, 0x4, 0x4, 0x8f9980, 0x7f
c06d5fa601, 0xc0002513c0)
        /snap/go/2890/src/io/io.go:402 +0x125
io.Copy(0x9f3be0, 0xc000251340, 0x9f3ba0, 0xc0002513c0, 0x9176c0, 0x0, 0x7fc06d5fa678)
        /snap/go/2890/src/io/io.go:364 +0x5a
io.CopyN(0x9f3be0, 0xc000251340, 0x7fc06d5fa678, 0xc0002f0900, 0x4, 0x4, 0x1, 0x0)
        /snap/go/2890/src/io/io.go:340 +0x86
github.com/9seconds/mtg/wrappers.(*MTProtoFrame).Read(0xc000251180, 0x96a200, 0xb, 0xc0005f3c00, 0x6
, 0x6)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/wrappers/mtproto_frame.go:51 +0x192
github.com/9seconds/mtg/wrappers.(*MTProtoProxy).Read(0xc000134f90, 0x0, 0x0, 0x0, 0x0, 0x0)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/wrappers/mtproto_proxy.go:36 +0x1e6
github.com/9seconds/mtg/proxy.(*Proxy).middlePipe(0xc00025e920, 0x7fc06d64e3a0, 0xc000134f90, 0x7fc0
6d64e3e0, 0xc000134b40, 0xc00028ce10, 0xc000310786)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/proxy/proxy.go:131 +0x83
github.com/9seconds/mtg/proxy.(*Proxy).accept(0xc00025e920, 0x9fcae0, 0xc000098020)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/proxy/proxy.go:96 +0x9aa
created by github.com/9seconds/mtg/proxy.(*Proxy).Serve
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/proxy/proxy.go:39 +0x18e

goroutine 5475 [chan receive]:
github.com/9seconds/mtg/proxy.(*Proxy).accept.func2(0x9fa0a0, 0xc00009c040, 0x7fc06d64e2f0, 0xc00013
e420, 0x7fc06d5fa5c8, 0xc000134cf0)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/proxy/proxy.go:84 +0x4c
created by github.com/9seconds/mtg/proxy.(*Proxy).accept
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/proxy/proxy.go:83 +0x74f

goroutine 5420 [chan receive, 1 minutes]:
github.com/9seconds/mtg/proxy.(*Proxy).accept.func2(0x9fa0a0, 0xc00009c080, 0x7fc06d64e2f0, 0xc00013
4f90, 0x7fc06d5fa5c8, 0xc000134b40)
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/proxy/proxy.go:84 +0x4c
created by github.com/9seconds/mtg/proxy.(*Proxy).accept
        /home/vagrant/safe/go/src/github.com/9seconds/mtg/proxy/proxy.go:83 +0x74f

Please give me further instruction to track this down.

error running

hi matser
how can i fix it?

root@0x9a:~/mtg# ./run-mtg.sh
Using default tag: latest
latest: Pulling from nineseconds/mtg
Digest: sha256:8d78d690a0aa139521db17140720946d21ce150d254b5c39cbea02c948dad6a0
Status: Image is up to date for nineseconds/mtg:latest
31a26a9b2ea6
222813751c4a91dcaa26cb00051f216b1fd40b915f1fcb4901d1c102874b916c
docker: Error response from daemon: OCI runtime create failed: container_linux.go:348: starting container process caused "process_linux.go:402: container init caused "open /proc/sys/net/ipv4/tcp_rmem: no such file or directory"": unknown.

Why would it cause error when using ADTag ?

My command line parameters :

./mtg-freebsd-amd64 -b 0.0.0.0 -p 5258 -s ddMY_KEY MY_ADTAG
{
  "ipv4": {
    "tg_url": "tg://proxy?port=5258&secret=ddMY_KEY&server=1.70.171.49",
    "tme_url": "https://t.me/proxy?port=5258&secret=ddMY_KEY&server=1.70.171.49",
    "tg_qrcode": "https://api.qrserver.com/v1/create-qr-code?data=tg%3A%2F%2Fproxy%3Fport%3D5258%26secret%3DddMY_KEY%26server%3D1.70.171.49&format=svg&qzone=4",
    "tme_qrcode": "https://api.qrserver.com/v1/create-qr-code?data=tg%3A%2F%2Fproxy%3Fport%3D5258%26secret%3DddMY_KEY%26server%3D1.70.171.49&format=svg&qzone=4"
  },
  "ipv6": {
    "tg_url": "",
    "tme_url": "",
    "tg_qrcode": "",
    "tme_qrcode": ""
  },
  "secret_for_mtproxybot": "MY_KEY"
}

If I use the command without the Adtag , the proxy run well and all my client could connect through the mtg proxy server . But , if I run the command with the Adtag , I got the bellow errors :

{"level":"error","ts":1555787930.6312413,"logger":"main","msg":"Cannot initialize server connection","connection_id":"f9f96d1c-ad40-46dc-93ce-86257d9485f5","error":"Cannot handshake telegram: Cannot read RPC handshake response: Cannot read frame padding: Cannot read from socket: EOF","errorVerbose":"EOF\n/home/vagrant/safe/go/src/github.com/9seconds/mtg/wrappers/blockcipher.go:37: Cannot read from socket\n/home/vagrant/safe/go/src/github.com/9seconds/mtg/wrappers/mtproto_frame.go:52: Cannot read frame padding\n/home/vagrant/safe/go/src/github.com/9seconds/mtg/telegram/middle.go:100: Cannot read RPC handshake response\n/home/vagrant/safe/go/src/github.com/9seconds/mtg/proxy/proxy.go:118: Cannot handshake telegram"}

in the issue #65 https://github.com/9seconds/mtg/issues/65 , the reason was caused by time sync , but I checked my time , it was all right and I run NTP as background service.

So ,how could I resolve the problem ?

my system is FreeBSD 12.0 .

can't run docker exec -ti mtg "anything"

I read the Dockerfile and I know it's alpine but I can't even docker exec -ti mtg cat something or `docker exec -ti mtg apk add' something or run bash or anything.

What is preventing me from doing so?

Multi-secrets mode

I think it's a good idea to implement a multi-secrets mode. Although you have an opinion that one secret is enough there are a lot of situations when such mode would be useful. For example: private proxy for corporate use, each department has individual secret so if a secret leaked out, it's easier to change it for several users than for all corporation. This mode should be optional and must be disabled by default.

Connection multiplexing

Right now we establish 1:1 connections to Telegram even in case of middle proxies which supports multiplexing. The idea is to try to multiplex M clients to N telegram connections. In that case we will have M*N connections instead of M^2.

Periodic verification of time drift

If a proxy works in promoted channel mode then it is crucial to have time synchronized. Unfortunately, almost everyone (even I personally) had a problem with drifted time so we need to notify users somehow on that.

From RPC protocol I would say that time drift has to be less than 1 second.

Log config

Apparently, it is quite hard to investigate the problems if mtg does not log configuration

Export stats

I cannot manage all known monitoring systems available so we need to support either collectd or statsd. All these tools support export to Prometheus, Graphite etc so I think it makes sense to export to those aggregators first.

Not connected

log:

{
"ipv4": {
"tg_url": "tg://proxy?port=8946&secret=dd5524ee2e3a7015045f12934417b947f0&server=x.x.x.x",
"tme_url": "https://t.me/proxy?port=8946&secret=dd5524ee2e3a7015045f12934417b947f0&server=x.x.x.x",
"tg_qrcode": "https://api.qrserver.com/v1/create-qr-code?data=tg%3A%2F%2Fproxy%3Fport%3D8946%26secret%3Ddd5524ee2e3a7015045f12934417b947f0%26server%3Dx.x.x.x&format=svg&qzone=4",
"tme_qrcode": "https://api.qrserver.com/v1/create-qr-code?data=tg%3A%2F%2Fproxy%3Fport%3D8946%26secret%3Ddd5524ee2e3a7015045f12934417b947f0%26server%3Dx.x.x.x&format=svg&qzone=4"
},
"ipv6": {
"tg_url": "",
"tme_url": "",
"tg_qrcode": "",
"tme_qrcode": ""
},
"secret_for_mtproxybot": "5524ee2e3a7015045f12934417b947f0"
}
{"level":"error","ts":1541425163.1271372,"logger":"main","msg":"Cannot initialize client connection","connection_id":"e6e5d5e4-bff4-4e9d-a494-524308aebd48","error":"Cannot extract frame: Cannot extract obfuscated header: read tcp x.x.x.x:8946->x.x.x.x:22870: i/o timeout","errorVerbose":"read tcp x.x.x.x:8946->x.x.x.x:22870: i/o timeout\n/home/vagrant/safe/go/src/github.com/9seconds/mtg/obfuscated2/frame.go:87: Cannot extract obfuscated header\n/home/vagrant/safe/go/src/github.com/9seconds/mtg/client/direct.go:36: Cannot extract frame"}
{"level":"error","ts":1541425163.77422,"logger":"main","msg":"Cannot initialize client connection","connection_id":"61db5fa5-50fc-4f6f-b261-347e5381df68","error":"Cannot extract frame: Cannot extract obfuscated header: read tcp x.x.x.x:8946->x.x.x.x:22879: i/o timeout","errorVerbose":"read tcp x.x.x.x:8946->x.x.x.x:22879: i/o timeout\n/home/vagrant/safe/go/src/github.com/9seconds/mtg/obfuscated2/frame.go:87: Cannot extract obfuscated header\n/home/vagrant/safe/go/src/github.com/9seconds/mtg/client/direct.go:36: Cannot extract frame"}
{"level":"error","ts":1541425163.7894843,"logger":"main","msg":"Cannot initialize client connection","connection_id":"5a8ab790-681f-4e6b-b8ff-02a844a6b4d0","error":"Cannot extract frame: Cannot extract obfuscated header: read tcp x.x.x.x:8946->x.x.x.x:22880: i/o timeout","errorVerbose":"read tcp x.x.x.x:8946->x.x.x.x:22880: i/o timeout\n/home/vagrant/safe/go/src/github.com/9seconds/mtg/obfuscated2/frame.go:87: Cannot extract obfuscated header\n/home/vagrant/safe/go/src/github.com/9seconds/mtg/client/direct.go:36: Cannot extract frame"}

What is wrong?how to fix it?

Humanize statistics

Even if we have clear statistics some numbers are not easily readable by humans (iterm2 helps but not everyone has it). Let's use go-humanize or something like that for marshaling such items.

Outgoing IP address

Как заставить устанавливать исходящие соединения с нужного адреса (интерфейса)?
У сервера 2 провайдера: один блокирует телеграм, второй нет. Настроен source routing.
Обычно достаточно настроить SRC ip адрес (например tcp_outgoing_adress в squid). Ни -b ни -4 не помогают, трафик всегда выходит через default gateway, с его src ip.

Rework stats

I do not like the mess I did there. I need to sit and rework the whole module, to avoid global locks in statsd client.

Prometheus integration

Statsd is fine but people are asking to have a native Prometheus integration without interim statsd service.

Cannot parse obfuscated frame: Unknown protocol: Unknown handshake protocol

version: '2'
services:
  mtg:
    image: nineseconds/mtg:latest
    restart: always
    ports:
     - "8848:8848/tcp"
    environment:
     - MTG_PORT=8848
    command: 4cf9XX44c

same with dd4cf9XX44c and mtg:stable, but it works for my apps, it's "old app" errors?

mtg_1 | {"level":"error","ts":1540717142.1215146,"logger":"main","msg":"Cannot initialize client connection","connection_id":"f613f242-23b1-4508-8c47-94f2b408b2a8","error":"Cannot parse obfuscated frame: Unknown protocol: Unknown handshake protocol","errorVerbose":"github.com/9seconds/mtg/mtproto/connection_options.go:86: Unknown handshake protocol\ngithub.com/9seconds/mtg/obfuscated2/obfuscated2.go:40: Unknown protocol\ngithub.com/9seconds/mtg/client/direct.go:43: Cannot parse obfuscated frame"} mtg_1 | {"level":"error","ts":1540717142.6385324,"logger":"main","msg":"Cannot initialize client connection","connection_id":"cba5e4ef-4286-454f-99ea-b4a071f6208a","error":"Cannot parse obfuscated frame: Unknown protocol: Unknown handshake protocol","errorVerbose":"github.com/9seconds/mtg/mtproto/connection_options.go:86: Unknown handshake protocol\ngithub.com/9seconds/mtg/obfuscated2/obfuscated2.go:40: Unknown protocol\ngithub.com/9seconds/mtg/client/direct.go:43: Cannot parse obfuscated frame"}

Slowly connect

hi master i'm use
4096mb/DDR4
3000MHZ CPU 2

my connection is 400 but connection is very slowly how can up it!?

IP адрес

Добрый день
Возможно ли чтобы ip адрес клиента не отправлялся на сервер телеграм. Чтобы все клиенты представлялись ip адресом сервера mtprotoproxy. Если не правильно выразился пожалуйста поправьте.

Async stats

Current stats implementation is blocking. Even if we use atomic. Let's go OTP way and create goroutines for updating stats.

Prometheus выдает метрики без префиксов

На данный момент по /prometheus/ выдается что-то вроде:

# HELP go_gc_duration_seconds A summary of the GC invocation durations.
# TYPE go_gc_duration_seconds summary
go_gc_duration_seconds{quantile="0"} 1.7208e-05
go_gc_duration_seconds{quantile="0.25"} 1.9649e-05
go_gc_duration_seconds{quantile="0.5"} 3.1934e-05
go_gc_duration_seconds{quantile="0.75"} 3.7506e-05
go_gc_duration_seconds{quantile="1"} 4.7894e-05
go_gc_duration_seconds_sum 0.000328102
go_gc_duration_seconds_count 11
# HELP go_goroutines Number of goroutines that currently exist.
# TYPE go_goroutines gauge
go_goroutines 19
# HELP go_info Information about the Go environment.
# TYPE go_info gauge
go_info{version="go1.11.1"} 1
# HELP go_memstats_alloc_bytes Number of bytes allocated and still in use.
# TYPE go_memstats_alloc_bytes gauge
go_memstats_alloc_bytes 1.81644e+06
# HELP go_memstats_alloc_bytes_total Total number of bytes allocated, even if freed.
# TYPE go_memstats_alloc_bytes_total counter
go_memstats_alloc_bytes_total 2.9329432e+07
# HELP go_memstats_buck_hash_sys_bytes Number of bytes used by the profiling bucket hash table.
# TYPE go_memstats_buck_hash_sys_bytes gauge
go_memstats_buck_hash_sys_bytes 1.456191e+06
# HELP go_memstats_frees_total Total number of frees.
# TYPE go_memstats_frees_total counter
go_memstats_frees_total 343729
# HELP go_memstats_gc_cpu_fraction The fraction of this program's available CPU time used by the GC since the program started.
# TYPE go_memstats_gc_cpu_fraction gauge
go_memstats_gc_cpu_fraction 6.0251014312355185e-05
# HELP go_memstats_gc_sys_bytes Number of bytes used for garbage collection system metadata.
# TYPE go_memstats_gc_sys_bytes gauge
go_memstats_gc_sys_bytes 2.379776e+06
# HELP go_memstats_heap_alloc_bytes Number of heap bytes allocated and still in use.
# TYPE go_memstats_heap_alloc_bytes gauge
go_memstats_heap_alloc_bytes 1.81644e+06
# HELP go_memstats_heap_idle_bytes Number of heap bytes waiting to be used.
# TYPE go_memstats_heap_idle_bytes gauge
go_memstats_heap_idle_bytes 6.3315968e+07
# HELP go_memstats_heap_inuse_bytes Number of heap bytes that are in use.
# TYPE go_memstats_heap_inuse_bytes gauge
go_memstats_heap_inuse_bytes 3.366912e+06
# HELP go_memstats_heap_objects Number of allocated objects.
# TYPE go_memstats_heap_objects gauge
go_memstats_heap_objects 13662
# HELP go_memstats_heap_released_bytes Number of heap bytes released to OS.
# TYPE go_memstats_heap_released_bytes gauge
go_memstats_heap_released_bytes 0
# HELP go_memstats_heap_sys_bytes Number of heap bytes obtained from system.
# TYPE go_memstats_heap_sys_bytes gauge
go_memstats_heap_sys_bytes 6.668288e+07
# HELP go_memstats_last_gc_time_seconds Number of seconds since 1970 of last garbage collection.
# TYPE go_memstats_last_gc_time_seconds gauge
go_memstats_last_gc_time_seconds 1.5408163657060204e+09
# HELP go_memstats_lookups_total Total number of pointer lookups.
# TYPE go_memstats_lookups_total counter
go_memstats_lookups_total 0
# HELP go_memstats_mallocs_total Total number of mallocs.
# TYPE go_memstats_mallocs_total counter
go_memstats_mallocs_total 357391
# HELP go_memstats_mcache_inuse_bytes Number of bytes in use by mcache structures.
# TYPE go_memstats_mcache_inuse_bytes gauge
go_memstats_mcache_inuse_bytes 1728
# HELP go_memstats_mcache_sys_bytes Number of bytes used for mcache structures obtained from system.
# TYPE go_memstats_mcache_sys_bytes gauge
go_memstats_mcache_sys_bytes 16384
# HELP go_memstats_mspan_inuse_bytes Number of bytes in use by mspan structures.
# TYPE go_memstats_mspan_inuse_bytes gauge
go_memstats_mspan_inuse_bytes 53656
# HELP go_memstats_mspan_sys_bytes Number of bytes used for mspan structures obtained from system.
# TYPE go_memstats_mspan_sys_bytes gauge
go_memstats_mspan_sys_bytes 147456
# HELP go_memstats_next_gc_bytes Number of heap bytes when next garbage collection will take place.
# TYPE go_memstats_next_gc_bytes gauge
go_memstats_next_gc_bytes 4.194304e+06
# HELP go_memstats_other_sys_bytes Number of bytes used for other system allocations.
# TYPE go_memstats_other_sys_bytes gauge
go_memstats_other_sys_bytes 389305
# HELP go_memstats_stack_inuse_bytes Number of bytes in use by the stack allocator.
# TYPE go_memstats_stack_inuse_bytes gauge
go_memstats_stack_inuse_bytes 425984
# HELP go_memstats_stack_sys_bytes Number of bytes obtained from system for stack allocator.
# TYPE go_memstats_stack_sys_bytes gauge
go_memstats_stack_sys_bytes 425984
# HELP go_memstats_sys_bytes Number of bytes obtained from system.
# TYPE go_memstats_sys_bytes gauge
go_memstats_sys_bytes 7.1497976e+07
# HELP go_threads Number of OS threads created.
# TYPE go_threads gauge
go_threads 7
# HELP mtg_connections Current number of connections to the proxy.
# TYPE mtg_connections gauge
mtg_connections{protocol="v4",type="abridged"} 0
mtg_connections{protocol="v4",type="intermediate"} 0
mtg_connections{protocol="v4",type="secure"} 2
mtg_connections{protocol="v6",type="abridged"} 0
mtg_connections{protocol="v6",type="intermediate"} 0
mtg_connections{protocol="v6",type="secure"} 0
# HELP mtg_crashes How many crashes happened.
# TYPE mtg_crashes gauge
mtg_crashes 0
# HELP mtg_speed Current throughput in bytes per second.
# TYPE mtg_speed gauge
mtg_speed{direction="egress"} 0
mtg_speed{direction="ingress"} 0
# HELP mtg_traffic Traffic passed through the proxy in bytes.
# TYPE mtg_traffic gauge
mtg_traffic{direction="egress"} 1006
mtg_traffic{direction="ingress"} 878
# HELP process_cpu_seconds_total Total user and system CPU time spent in seconds.
# TYPE process_cpu_seconds_total counter
process_cpu_seconds_total 0.46
# HELP process_max_fds Maximum number of open file descriptors.
# TYPE process_max_fds gauge
process_max_fds 4096
# HELP process_open_fds Number of open file descriptors.
# TYPE process_open_fds gauge
process_open_fds 15
# HELP process_resident_memory_bytes Resident memory size in bytes.
# TYPE process_resident_memory_bytes gauge
process_resident_memory_bytes 1.7043456e+07
# HELP process_start_time_seconds Start time of the process since unix epoch in seconds.
# TYPE process_start_time_seconds gauge
process_start_time_seconds 1.54081612419e+09
# HELP process_virtual_memory_bytes Virtual memory size in bytes.
# TYPE process_virtual_memory_bytes gauge
process_virtual_memory_bytes 4.99564544e+08
# HELP process_virtual_memory_max_bytes Maximum amount of virtual memory available in bytes.
# TYPE process_virtual_memory_max_bytes gauge
process_virtual_memory_max_bytes -1
# HELP promhttp_metric_handler_requests_in_flight Current number of scrapes being served.
# TYPE promhttp_metric_handler_requests_in_flight gauge
promhttp_metric_handler_requests_in_flight 1
# HELP promhttp_metric_handler_requests_total Total number of scrapes by HTTP status code.
# TYPE promhttp_metric_handler_requests_total counter
promhttp_metric_handler_requests_total{code="200"} 0
promhttp_metric_handler_requests_total{code="500"} 0
promhttp_metric_handler_requests_total{code="503"} 0

С go_memstats и прочими внутренними метриками без тегов.
Настройку префикса оно игнорирует.
Можно ли пофиксить это или сделать отдельный эндпоинт только с сервисными метриками mtg_* ?

What is the secure mode?

Is there a spec for the secure mode (with tag '0xdd')? What's the difference between this one and the abridged mode?

How to use ADTag with docker one-line runner code????????

So as the title shows I'm using the docker image and the one-line runner code you've provided to start my proxy:
$ docker run --name mtg --restart=unless-stopped -p 3128:3128 -p 3129:3129 -d nineseconds/mtg:stable my-defined-secret
in this case the proxy starts with absolutely no problems.
The problem is that you haven't provided any information about how to implement adtag in this one-line runner code.
I tried to add my Adtag to the end of the code but then the the proxy server wouldn't start at all.
$ docker run --name mtg --restart=unless-stopped -p 3128:3128 -p 3129:3129 -d nineseconds/mtg:stable my-defined-secret my-adtag

log file:
mtg-error-log.txt

so can you please illustrate the way to implement adtag?

Avoid hardcoded proxies / Promoted channels

If we use Telegram API, we do not need to have all these hardcodes + now it is clear why do we need negative DCs

$ curl -s https://core.telegram.org/getProxyConfig -H "Accept: text/plain" --compressed

Unfortunately usage of force probability is totally unclear because this API call is not public: https://core.telegram.org/methods

🤦‍♂️

Cannot initialize client connection

Sometimes I get in logs:

{"level":"error","ts":1558105435.3307085,"logger":"main","msg":"Cannot initialize client connection","connection_id":"f4cb4c45-xxxx-xxxx-xxxx-xxxx6eccxxxx","error":"Cannot extract frame: Cannot extract obfuscated header: read tcp xx.xx.xx.xx:8443->88.232.168.38:19552: i/o timeout","errorVerbose":"read tcp xx.xx.xx.xx:8443->88.232.168.38:19552: i/o timeout\n/root/mtg/obfuscated2/frame.go:87: Cannot extract obfuscated header\n/root/mtg/client/direct.go:38: Cannot extract frame"}

Also the interesting thing that 88.232.168.38 IP is the TurkTelekom. But I haven't any connections with Turkish networks. Maybe these are DPI probes from the Turkey?

UPD: Another one error from the log without any IP's:

{"level":"error","ts":1558105659.805035,"logger":"main","msg":"Cannot initialize client connection","connection_id":"d4fa3c04-xxxx-xxxx-xxxx-xxxx6b3bxxxx","error":"Cannot extract frame: Cannot extract obfuscated header: EOF","errorVerbose":"EOF\n/root/mtg/obfuscated2/frame.go:87: Cannot extract obfuscated header\n/root/mtg/client/direct.go:38: Cannot extract frame"}

Base cleanup

Well, it is time to make a general cleanup and simplify the structure of the application. The initial version was done with another idea in mind and now looks awkward and clunky.

Unable to build

I try to build this way:

go get -v -u github.com/mtProtoProxy/mtg

At the end I get this:

go/src/src/github.com/mtProtoProxy/mtg/main.go:144:31: not enough arguments in call to config.NewConfig
have (bool, bool, uint32, uint32, net.IP, net.IP, net.IP, net.IP, uint16, uint16, uint16, uint16, uint16, string, string, string, string, map[string]string, []byte, []byte)
want (bool, bool, uint32, uint32, net.IP, net.IP, net.IP, net.IP, uint16, uint16, uint16, uint16, uint16, string, string, string, string, map[string]string, string, bool, []byte, []byte)
go/src/src/github.com/mtProtoProxy/mtg/main.go:191:12: undefined: stats.Start

===

Am I doing something wrong or there is a bug?

SYS: Centos 7

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.