Datagram libp2p API #3527
Replies: 3 comments 9 replies
-
Thanks for the write-up. Will reply more in depth. In the meantime: When libp2p calls |
Beta Was this translation helpful? Give feedback.
-
How does |
Beta Was this translation helpful? Give feedback.
-
@mxinden filled me in on this topic in an out-of-band discussion. As far as I understand, you "just" want to reuse the QUIC endpoint to send your own datagrams. Instead of tunneling that through (multiple) libp2p abstractions, would it be feasible to redesign our QUIC transport such that the "Endpoint" can be shared with other parts of the application? The design would roughly be that the protocols you run through libp2p end up emitting events you can capture from the |
Beta Was this translation helpful? Give feedback.
-
Hi lib2p folks,
At Stormshield we have built a tunneling vpn using libp2p. We start several instances of libp2p, basically one instance for each tunneled network and we manage our own custom virtual transport/muxer that delegates swarm dial and listen requests to our front component. Our front handles real transport connections using Quinn directly (the reason why we use this architecture is not the point here).
So you'd guess it, our goal is to tunnel packets using libp2p facilities and we have implemented our own libp2p protocol for this. But doing it using Substream's traits AsyncRead/AsyncWrite is not easy for two reasons:
For those reasons we have patched libp2p and added two new traits DgramRead and DgramWrite to libp2p Substream. Substreams returned by our virtual muxer creates structs that both implement AsyncRead/AsyncWrite and DgramRead/DgramWrite so libp2p swarm can negotiate protocols using the AsyncRead/AsyncWrite API, and our own libp2p protocol can uses the new API in order to tunnel packets. Regarding performance our code allows to use both the two APIs to tunnel packets, and we get throughput multiplied by 280 when using the DgramRead/DgramWrite API with a basic iperf3 test. Is is important to note that the DgramRead/DgramWrite API use the crate Bytes, allowing a zero copy packet pathway.
Now my question is: have you some plans or have you ever thought providing such an API in libp2p ?
Thanks for your response,
Philippe
Beta Was this translation helpful? Give feedback.
All reactions