Crates.io | swarm_proxy |
lib.rs | swarm_proxy |
version | 0.1.0 |
source | src |
created_at | 2023-11-13 19:41:13.700827 |
updated_at | 2023-11-13 19:41:13.700827 |
description | A proxy for forwarding a bunch of ports really quickly |
homepage | https://github.com/jkcoxson/swarm_proxy |
repository | https://github.com/jkcoxson/swarm_proxy |
max_upload_size | |
id | 1033956 |
size | 38,077 |
A proxy that forwards a lot of ports really fast and is also pretty quick too
I had a server behind a double NAT, and masquerading all the ports would have been a lot of effort. I'm lazy, so I wrote a proxy to work around a solvable problem :)
swarm_proxy <config.json> | <target> udp [<udp_port|udp_range>] tcp [<tcp_port|tcp_range>]
Forwards ports 69-79 udp and 80 and 443 to 8443 tcp to 10.7.0.2
swarm_proxy 10.7.0.2 udp 69-79:69-79 tcp 80 443:8443
Super simple, connection goes in, new connection made and packets are exchanged.
Not as simple. UDP is stateless, but server needs to know which port to forward to on the way back. When a packet is sent, a new port is bound in the proxy server only for sending back to that one client. Clients are bound for about five minutes, then the port is released. Tokio channels go brrrr.
Pretty quick, I'm not about to talk trash about my own proxy. I ran a few benchmarks with iperf, the speed in and out of the proxy was negligable. Open a PR if you have better benchmarks, or don't.