MarcelCoding / zia

Proxy UDP over WebSocket - useful to use WireGuard in restricted networks.
GNU Affero General Public License v3.0
34 stars 10 forks source link

Multiple websocket connections #82

Open sudozid opened 1 year ago

sudozid commented 1 year ago

Hi

Im wondering if it would be possible for multiple websocket connections to be implemented for better performance. This would make a big difference if ISPs throttle connections or if distance between client and the server is high

Thanks

MarcelCoding commented 1 year ago

Definitely an interesting topic also for the only TCP version. This would also probably make use of multiple CPU cores. Currently, on thread (tokio task) is dedicated to TX and one to RX. With multiple connections, this could probably implement multithreaded. I'll look into it, but I can't specify any time span for results.

MarcelCoding commented 1 year ago

@sudozid I've played a bit around and did a rewrite. Now, multiple websocket connections should be possible. https://github.com/MarcelCoding/zia/pull/105

Till now I've only deployed the server and client on my laptop and for some reason could not reach some websites. If I use the new client on my laptop but the old (master branch) zia deployed on my server, it works fine. So if it isn't a problem with the server and client on the same machine it is a problem on the server side.

The client has a new option -c so specify the amount of connections that should be used. Also, the Pull Request currently only supports websocket and no tcp. Additionally, I've disabled websocket masking for frames send from the client (a thing the spec enforces). Because the old server is spec complaint, it requires masking of frames send from the client. You can tell the client to force masking using -m. The new server accepts masked and non-masked frames without any configuration. This also could be useful if some kind of http proxy rejects non-masked websocket frames send from the client. (idk why this should be done)

I hope you are able to use the new version without any documentation and just using --help. The binaries are available as artifacts of the actions of the latest commit in the pull request. (you need to be logged in in order to download them)

MarcelCoding commented 10 months ago

I've merged it into master, show builds are now available through actions. I've seen a massive improvement: (my school)

Feel free to provide feedback.

Also, it should now be may more stable. But if one connection dies, the client currently not tries to open new ones.