-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat: unreliable datagram support (QUIC + libp2p-datagram) #6489
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
royzah
wants to merge
22
commits into
libp2p:master
Choose a base branch
from
royzah:feat/quic-datagrams
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 11 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
2129a42
feat(quic): unreliable datagram support + libp2p-datagram behaviour
royzah 77bf5cb
Merge branch 'master' into feat/quic-datagrams
royzah 986572d
docs: fill changelog PR links (6489)
royzah 4e33535
fix: fold changes into pending 0.44/0.48/0.14 release, add datagram c…
royzah d3164a8
ci(semver): exclude unpublished libp2p-datagram from semver-checks
royzah e04e3a3
feat(core,swarm,quic): expose transport stream id via StreamMuxer::su…
royzah 4844599
feat(datagram): implement specs#680 /dg/1 control stream and framing
royzah 39a828b
docs(metrics): changelog for substream_id forward (6489)
royzah 6a771ce
perf(datagram): bound the pre-establish outbound backlog
royzah 2955f0e
Merge branch 'master' into feat/quic-datagrams
royzah c88803f
Merge branch 'master' into feat/quic-datagrams
royzah 6042d6f
docs(datagram): note the intentional silent-drop on bad/unknown strea…
royzah 15062bd
fix(swarm): log datagram send failure at error level
royzah 8037022
ci: run semver-checks on libp2p-datagram
royzah 033702c
Merge branch 'master' into feat/quic-datagrams
jxs f6bb59b
feat(datagram): report per-connection max datagram size to the sender
royzah 35a6375
refactor(datagram): centralize inbound datagram routing at the connec…
royzah 542b641
Merge remote-tracking branch 'upstream/master' into feat/quic-datagrams
royzah 57d3071
docs(changelog): note the new ConnectionEvent variant in affected crates
royzah 9d0db2b
fix(perf): drop the redundant binding beta clippy flags under the res…
royzah 53d7cce
Merge remote-tracking branch 'upstream/master' into feat/quic-datagrams
royzah f1c6c92
style(perf): apply rustfmt after the pattern simplification
royzah File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| ## 0.1.0 | ||
|
|
||
| - Initial release: a `Behaviour` and `Control` for sending and receiving | ||
| unreliable datagrams over libp2p connections (QUIC only), implementing the | ||
| `/dg/1` control stream and framing from [libp2p/specs#680]. `Behaviour::new` | ||
| takes the application protocol the datagrams belong to. | ||
| See [PR 6489](https://github.com/libp2p/rust-libp2p/pull/6489). | ||
|
|
||
| [libp2p/specs#680]: https://github.com/libp2p/specs/pull/680 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| [package] | ||
| name = "libp2p-datagram" | ||
| version = "0.1.0" | ||
| edition.workspace = true | ||
| rust-version.workspace = true | ||
| description = "Unreliable datagram protocol for libp2p" | ||
| license = "MIT" | ||
| repository = "https://github.com/libp2p/rust-libp2p" | ||
| keywords = ["peer-to-peer", "libp2p", "networking"] | ||
| categories = ["network-programming", "asynchronous"] | ||
|
|
||
| [dependencies] | ||
| bytes = { workspace = true } | ||
| futures = { workspace = true } | ||
| libp2p-core = { workspace = true } | ||
| libp2p-identity = { workspace = true, features = ["peerid"] } | ||
| libp2p-swarm = { workspace = true } | ||
| thiserror = { workspace = true } | ||
| unsigned-varint = { workspace = true, features = ["futures"] } | ||
|
|
||
| [dev-dependencies] | ||
| libp2p-identity = { workspace = true, features = ["ed25519", "rand"] } | ||
| libp2p-quic = { workspace = true, features = ["tokio"] } | ||
| libp2p-swarm = { workspace = true, features = ["tokio"] } | ||
| tokio = { workspace = true, features = ["full"] } | ||
| tracing-subscriber = { workspace = true, features = ["env-filter"] } | ||
|
|
||
| [lints] | ||
| workspace = true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| # libp2p-datagram | ||
|
|
||
| Unreliable datagrams over libp2p connections, per [libp2p/specs#680]. | ||
|
|
||
| Datagrams ride a QUIC `/dg/1` control stream that binds them to one application | ||
| protocol. They may be dropped, reordered, or duplicated and carry no flow | ||
| control; the caller owns reliability. Only QUIC carries them today; sends on | ||
| other transports fail with `SendError`. | ||
|
|
||
| ```rust,no_run | ||
| use libp2p_datagram as datagram; | ||
| use libp2p_swarm::StreamProtocol; | ||
|
|
||
| let mut behaviour = datagram::Behaviour::new(StreamProtocol::new("/my/app/1.0.0")); | ||
| let mut control = behaviour.new_control(); | ||
| let mut incoming = behaviour.incoming_datagrams().unwrap(); | ||
|
|
||
| // add `behaviour` to your Swarm, then: | ||
| // control.send_datagram(peer, bytes)?; | ||
| // while let Some((from, bytes)) = incoming.next().await { ... } | ||
| ``` | ||
|
|
||
| ## License | ||
|
|
||
| Licensed under MIT. | ||
|
|
||
| [libp2p/specs#680]: https://github.com/libp2p/specs/pull/680 |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.