TelegramMessenger / MTProxy

4.88k stars 812 forks source link

Upstream Proxy support #143

Open DRSDavidSoft opened 6 years ago

DRSDavidSoft commented 6 years ago

Is there a chance that MTProxy supports SOCKS5 or HTTP upstream proxy? So I can run in on a local server that relays data through the proxy.

wfjsw commented 6 years ago

Upstream Proxy Support seems impossible due to this: https://github.com/TelegramMessenger/MTProxy/blob/cc7b7097a5bc1681d0f4c05d5f07576c8b279fc4/net/net-crypto-aes.c#L236-L238

Your IP address & port used to connect Telegram is actually part of the encryption key you used to connect to Telegram Cluster. This is really a retarded design but we cannot do anything with it now.

UPDATE: fix the wrong link.

DRSDavidSoft commented 6 years ago

Hmm, it's interesting and disappointing at the same time. Is there a link to the MTProxy protocol specs?

I think rather than a proxy, a layer-2 vpn should be in this case, and by your description, the IP and port of the upstream server should be used.

Can we keep this issue open, in the chance that the secret key mechanism changes?

wfjsw commented 6 years ago

No, but I found this implemention easier to understand: https://github.com/alexbers/mtprotoproxy