rapiz1 / rathole

A lightweight and high-performance reverse proxy for NAT traversal, written in Rust. An alternative to frp and ngrok.
Apache License 2.0
8.8k stars 440 forks source link

Add support for adjustable multiplexing (MUX) to the tunnel #322

Closed OnceUponATimeInAmerica closed 5 months ago

OnceUponATimeInAmerica commented 5 months ago

Hello and thank you for rathole.

Feature Proposed It would have been great if rathole could (optionally) support multiplexing of multiple logical connections into a single TCP connection with the multiplicity of the tunnel being adjustable by the user (client side).

By adjustable multiplicity, I mean client can specify how many logical connections are tunneled thru a single physical connection to the server, before an additional physical TCP connection is spawned by the tunnel; Therefore a flexible relationship between logical and physical connections is achieved.

It would be still greater, if granularity of multiplexing (e.g. per service or per client etc.) could also be specified.

Use Case Many times, when the number of users/services is high the total number of logical connections can go into hundreds or thousands per server and this can create delays, etc. in less than ideal networks (especially in the developing world). Mux allows keeping a tighter control by the tunnel on the number of physical/underlying TCP connections thus better ensuring overall user connectivity experience and quality.

As shown in implementation of tools such as v2ray core (Xray, SingBox, etc. ), supporting mux, greatly reduces the time of setup of new logical/application-requested connections.

Also many datacenters, ISPs, traffic censors and other network agents are sensitive to number of concurrent real/physical connection and this options might help in those scenarios.

Thank you.