I had no idea for a useful Rust project - so here is a useless one
I present to you... (drum roll)
๐ก TCP over HTTP
You can now SSH through a HTTP reverse proxy like Nginx.
You have to set up a entry node and an exit node.
The entry node is on your side.
It converts your TCP traffic to HTTP traffic.
On the target side, behind Nginx is the exit node.
It converts the incoming HTTP requests back to TCP traffic.
๐ฅฆ How does it work?
When you connect with TCP to the entry node, it tells the exit node to establish a TCP counterpart connection.
If it succeeds, everything is set up.
For incoming data, the entry node sends HTTP requests to the exit node, which forwards that data.
The entry node also requests to download response data from the exit node.
If there is no data, the exit node blocks the HTTP request until there is data.
This ensures low latency instead of a dirty while-sleep loop.
Data is currently base64 encoded which, I know, is not the most efficient way to transfer binary via HTTP. But I was too lazy to dive into that part.
๐ The Rusty part
This project was a little async training for me.
The code looks absolutely awful because I learned a lot along the way and was too lazy to refactor.
Used libraries are Rocket for the HTTP server, Tokio for TCP socket stuff and hyper for HTTP clienting.
๐ How is the performance?
Well, it's everything but
๐ blazingly fast.
6MiB/s currently, but in theory there is a lot of room for optimization.
It's just a proof of concept though, so I don't think I will put more time or effort into this.
The latency is quite okay though. Keeping SSH sessions open is no problem at all.
No lags or delays.