dumbpipe icon indicating copy to clipboard operation
dumbpipe copied to clipboard

UDP proxy support added

Open unalkalkan opened this issue 11 months ago • 3 comments

Any feedback is highly appreciated since this is my hello-world Rust and Iroh project, I was learning and implementing concepts as I discover them.

Needs some updates on README.md to state udp proxy is supported and how it's used before merging the PR.

unalkalkan avatar Feb 21 '25 22:02 unalkalkan

I want to use dumbpipe to punch holes for sending syslog and I'd rather do syslog with UDP than TCP in this scenario (don't mind if I lose logs; dont want the TCP backpressure issues)

Having UDP support would be great, so I hope this gets merged.

feld avatar Apr 11 '25 20:04 feld

Thanks for the PR, and sorry for not looking at it earlier.

In general, looks good. The code is nicely separated from the rest, so even if it makes dumbpipe quite a bit bigger it would be easy enough for somebody to strip it out if they want to use it as a starting point for their own work.

I have one concern however. You are using the datagram extension. But as far as I can tell from reading the RFC, the size of a datagram is 1. limited by a transport parameter to typically 64 KiB, but 2. limited further to a MTU.

https://datatracker.ietf.org/doc/html/rfc9221#section-5

Note that while the max_datagram_frame_size transport parameter places a limit on the maximum size of DATAGRAM frames, that limit can be further reduced by the max_udp_payload_size transport parameter and the Maximum Transmission Unit (MTU) of the path between endpoints. DATAGRAM frames cannot be fragmented; therefore, application protocols need to handle cases where the maximum datagram size is limited by other factors.

So this whole thing will only work for small UDP packets, and I am not quite sure what the behaviour will be for larger packets. Also, I don't know what you are trying to use this for. It might be that it works well for certain use cases but completely falls flat for others.

Another, somewhat weird, way to solve this would be to just 1 QUIC stream per packet. Not sure. Maybe @flub can enlighten us.

rklaehn avatar Jun 27 '25 12:06 rklaehn

There's Connection::max_datagram_size which gives you to maximum size you can send, but note that this can change over the lifetime of the connection. You'll get a SendDatagramError::TooLarge if you try to send something that does not fit.

Realistically any application which uses datagrams has to do it's own MTU discovery, or use a small maximum size like DNS does. So my gut reaction is "shrug, this is probably fine and is how the internet works".

flub avatar Jun 27 '25 12:06 flub