question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

proxy -> telegram connection multiplexing

See original GitHub issue

It looks like it’s possible to multiplex many client -> proxy connections into single proxy -> telegram server connection based on RPC connection ID

https://github.com/alexbers/mtprotoproxy/blob/ed227da7c3afe67c876cd922661eedd0ec87da78/mtprotoproxy.py#L330 https://github.com/alexbers/mtprotoproxy/blob/ed227da7c3afe67c876cd922661eedd0ec87da78/mtprotoproxy.py#L358

You just have to maintain mapping between client -> proxy and proxy -> telegram sockets and send packets as a whole. And, probably, you will need to have some kind of proxy -> telegram connection pool (separate pool for each dc_id)

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:1
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
alexberscommented, Jun 12, 2018

Nice graphs! I think I will forward small messages (<4096 bytes) directly and big messages by parts. Also, for big messages it is possible to implement speed throttling on tcp level.

I tested the official proxy and I managed it to occupy a 1MB per client. The interesting thing, when I tried to test with about 300 clients, the official client always crashes: image

I sent the program which predictably crashes a proxy by its address to the official proxy authors, hope they will fix soon.

0reactions
seriypscommented, Jun 13, 2018

The messages can have up to 1MByte size.

Isn’t it 64Mb? https://github.com/alexbers/mtprotoproxy/blob/master/mtprotoproxy.py#L304

3 bytes = 24bits and you multiply it by 4, so: 2**24 * 4 / 1024 / 1024 = 64

Read more comments on GitHub >

github_iconTop Results From Across the Web

MTProto · Project V Official - V2Ray
MTProto proxy is a special procol for Telegram. It consists of a pair of inbound and outboud proxies in V2Ray. They are usually...
Read more >
How To Use Proxies With Telegram
Step 1. Open Telegram and click on the three vertical lines at the top left of it. ... Step 2. On it's menu,...
Read more >
VPN over SSH? The Socks Proxy - Hacker News
I used this feature pretty often, but it has one downside: all connections are multiplexed into single one which is not good for...
Read more >
SSH Multiplexing and Master Mode - oooops.dev
Multiplexing is a feature provided by SSH which alleviates these problems. It allows a single TCP connection to carry multiple SSH sessions.
Read more >
Mux | V2Ray Beginner's Guide
Mux means multiplexing. In the current proxy tools, only V2Ray has this feature (2018-03-15 Note: there are other software implemented similar ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found