Skip to content

Commit

Permalink
feat(transports/quic): Add implementation based on quinn-proto (#2289)
Browse files Browse the repository at this point in the history
Co-authored-by: Demi Marie Obenour <demiobenour@gmail.com>
Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>
Co-authored-by: David Craven <david@craven.ch>
Co-authored-by: Max Inden <mail@max-inden.de>
Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
Co-authored-by: elenaf9 <elena.frank@protonmail.com>
Co-authored-by: Marco Munizaga <marco@marcopolo.io>
  • Loading branch information
8 people committed Nov 14, 2022
1 parent 7daa0c1 commit 0f5c491
Show file tree
Hide file tree
Showing 17 changed files with 3,164 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
- [`libp2p-noise` CHANGELOG](transports/noise/CHANGELOG.md)
- [`libp2p-plaintext` CHANGELOG](transports/plaintext/CHANGELOG.md)
- [`libp2p-pnet` CHANGELOG](transports/pnet/CHANGELOG.md)
- [`libp2p-quic` CHANGELOG](transports/quic/CHANGELOG.md)
- [`libp2p-tcp` CHANGELOG](transports/tcp/CHANGELOG.md)
- [`libp2p-uds` CHANGELOG](transports/uds/CHANGELOG.md)
- [`libp2p-wasm-ext` CHANGELOG](transports/wasm-ext/CHANGELOG.md)
Expand All @@ -47,6 +48,7 @@
# 0.50.0 - [unreleased]

- Introduce [`libp2p-tls` `v0.1.0-alpha`](transports/tls/CHANGELOG.md#010-alpha). See [PR 2945].
- Introduce [`libp2p-quic` `v0.7.0-alpha`](transports/quic/CHANGELOG.md#070-alpha). See [PR 2289].
- Remove deprecated features: `tcp-tokio`, `mdns-tokio`, `dns-tokio`, `tcp-async-io`, `mdns-async-io`, `dns-async-std`.
See [PR 3001].
- Introduce [`libp2p-tls` `v0.1.0`](transports/tls/CHANGELOG.md#010). See [PR 2945].
Expand Down Expand Up @@ -82,6 +84,7 @@
[PR 2945]: https://github.com/libp2p/rust-libp2p/pull/2945
[PR 3001]: https://github.com/libp2p/rust-libp2p/pull/3001
[PR 2945]: https://github.com/libp2p/rust-libp2p/pull/2945
[PR 2289]: https://github.com/libp2p/rust-libp2p/pull/2289
[PR 3055]: https://github.com/libp2p/rust-libp2p/pull/3055

# 0.49.0
Expand Down
8 changes: 6 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ full = [
"ping",
"plaintext",
"pnet",
"quic",
"macros",
"relay",
"rendezvous",
Expand All @@ -46,7 +47,7 @@ full = [
"websocket",
"yamux",
]
async-std = ["libp2p-mdns?/async-io", "libp2p-tcp?/async-io", "libp2p-dns?/async-std"]
async-std = ["libp2p-mdns?/async-io", "libp2p-tcp?/async-io", "libp2p-dns?/async-std", "libp2p-quic?/async-std"]
autonat = ["dep:libp2p-autonat"]
dcutr = ["dep:libp2p-dcutr", "libp2p-metrics?/dcutr"]
deflate = ["dep:libp2p-deflate"]
Expand All @@ -65,14 +66,15 @@ noise = ["dep:libp2p-noise"]
ping = ["dep:libp2p-ping", "libp2p-metrics?/ping"]
plaintext = ["dep:libp2p-plaintext"]
pnet = ["dep:libp2p-pnet"]
quic = ["dep:libp2p-quic"]
relay = ["dep:libp2p-relay", "libp2p-metrics?/relay"]
rendezvous = ["dep:libp2p-rendezvous"]
request-response = ["dep:libp2p-request-response"]
rsa = ["libp2p-core/rsa"]
secp256k1 = ["libp2p-core/secp256k1"]
serde = ["libp2p-core/serde", "libp2p-kad?/serde", "libp2p-gossipsub?/serde"]
tcp = ["dep:libp2p-tcp"]
tokio = ["libp2p-mdns?/tokio", "libp2p-tcp?/tokio", "libp2p-dns?/tokio"]
tokio = ["libp2p-mdns?/tokio", "libp2p-tcp?/tokio", "libp2p-dns?/tokio", "libp2p-quic?/tokio"]
uds = ["dep:libp2p-uds"]
wasm-bindgen = ["futures-timer/wasm-bindgen", "instant/wasm-bindgen", "getrandom/js"]
wasm-ext = ["dep:libp2p-wasm-ext"]
Expand Down Expand Up @@ -115,6 +117,7 @@ smallvec = "1.6.1"
libp2p-deflate = { version = "0.38.0", path = "transports/deflate", optional = true }
libp2p-dns = { version = "0.38.0", path = "transports/dns", optional = true }
libp2p-mdns = { version = "0.42.0", path = "protocols/mdns", optional = true }
libp2p-quic = { version = "0.7.0-alpha", path = "transports/quic", optional = true }
libp2p-tcp = { version = "0.38.0", path = "transports/tcp", optional = true }
libp2p-websocket = { version = "0.40.0", path = "transports/websocket", optional = true }
libp2p-tls = { version = "0.1.0-alpha", path = "transports/tls", optional = true }
Expand Down Expand Up @@ -160,6 +163,7 @@ members = [
"transports/tls",
"transports/plaintext",
"transports/pnet",
"transports/quic",
"transports/tcp",
"transports/uds",
"transports/websocket",
Expand Down
6 changes: 6 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ pub use libp2p_plaintext as plaintext;
#[cfg(feature = "pnet")]
#[doc(inline)]
pub use libp2p_pnet as pnet;
#[cfg(feature = "quic")]
#[cfg(not(any(target_os = "emscripten", target_os = "wasi", target_os = "unknown")))]
pub mod quic {
#[doc(inline)]
pub use libp2p_quic::*;
}
#[cfg(feature = "relay")]
#[doc(inline)]
pub use libp2p_relay as relay;
Expand Down
3 changes: 3 additions & 0 deletions transports/quic/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# 0.7.0-alpha [unreleased]

- Initial alpha release.
47 changes: 47 additions & 0 deletions transports/quic/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
[package]
name = "libp2p-quic"
version = "0.7.0-alpha"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2021"
description = "TLS based QUIC transport implementation for libp2p"
repository = "https://github.com/libp2p/rust-libp2p"
license = "MIT"

[dependencies]
async-std = { version = "1.12.0", default-features = false, optional = true }
bytes = "1.2.1"
futures = "0.3.15"
futures-timer = "3.0.2"
if-watch = "3.0.0"
libp2p-core = { version = "0.38.0", path = "../../core" }
libp2p-tls = { version = "0.1.0-alpha", path = "../tls" }
log = "0.4"
parking_lot = "0.12.0"
quinn-proto = { version = "0.9.0", default-features = false, features = ["tls-rustls"] }
rand = "0.8.5"
rustls = { version = "0.20.2", default-features = false }
thiserror = "1.0.26"
tokio = { version = "1.21.1", default-features = false, features = ["net", "rt"], optional = true }

[features]
tokio = ["dep:tokio", "if-watch/tokio"]
async-std = ["dep:async-std", "if-watch/smol"]

# Passing arguments to the docsrs builder in order to properly document cfg's.
# More information: https://docs.rs/about/builds#cross-compiling
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
rustc-args = ["--cfg", "docsrs"]

[dev-dependencies]
async-std = { version = "1.12.0", features = ["attributes"] }
env_logger = "0.9.0"
libp2p = { path = "../..", features = ["tcp", "yamux", "noise", "async-std"] }
libp2p-muxer-test-harness = { path = "../../muxers/test-harness" }
quickcheck = "1"
tokio = { version = "1.21.1", features = ["macros", "rt-multi-thread", "time"] }

[[test]]
name = "stream_compliance"
required-features = ["async-std"]

0 comments on commit 0f5c491

Please sign in to comment.