feat: unreliable datagram support (QUIC + libp2p-datagram)#6489
Conversation
Signed-off-by: Royyan Zahir <muhammad.royyan@tii.ae>
Signed-off-by: Royyan Zahir <muhammad.royyan@tii.ae>
…hangelog Signed-off-by: Royyan Zahir <muhammad.royyan@tii.ae>
Signed-off-by: Royyan Zahir <muhammad.royyan@tii.ae>
jxs
left a comment
There was a problem hiding this comment.
Hi, and thanks for starting this!
as commented on your specs post, wdyt of implementing libp2p/specs#680 and go from there? You're in need for this in production right? That would be a nice testbed for the spec
|
Nice, that's the direction we were hoping for. The quic/core/swarm bits here are the datagram primitive #680 needs anyway, so I'll keep those and rework the libp2p-datagram crate to match #680: |
|
specs#680 is implemented here: Two spec notes: one app-protocol per behaviour for now, and we drop on a bad/unknown stream id rather than raising PROTOCOL_VIOLATION (not reachable from this layer). |
Description
Adds unreliable datagram support to libp2p, end to end:
core:StreamMuxer::send_datagram/max_datagram_sizeandStreamMuxerEvent::Datagram(default: unsupported).quic: implements them over quinn datagrams, enabled by default and configurable.swarm:ConnectionEvent::Datagram(inbound) andConnectionHandlerEvent::SendDatagram(outbound).libp2p-datagramcrate: aBehaviour+Controlwithsend_datagram(peer, ...)and anIncomingDatagramsstream.Motivation and prior art: libp2p/specs#626 (IP over libp2p), #225, and the MTU edge in #4647. Tunnelling IP over reliable, ordered streams is 2-10x slower (HOL blocking; TCP-over-TCP meltdown); a datagram carrier fixes it.
Notes
quic::pollnow surfaces connection close via the datagram future (was alwaysPending).Open questions
quic::Config; happy to make it opt-in.#[non_exhaustive]?