Skip to content

Commit 0f5c491

Browse files
kppDemiMarietomakadvc94chmxinden
authored
feat(transports/quic): Add implementation based on quinn-proto (#2289)
Co-authored-by: Demi Marie Obenour <[email protected]> Co-authored-by: Pierre Krieger <[email protected]> Co-authored-by: David Craven <[email protected]> Co-authored-by: Max Inden <[email protected]> Co-authored-by: Thomas Eizinger <[email protected]> Co-authored-by: elenaf9 <[email protected]> Co-authored-by: Marco Munizaga <[email protected]>
1 parent 7daa0c1 commit 0f5c491

File tree

17 files changed

+3164
-3
lines changed

17 files changed

+3164
-3
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
- [`libp2p-noise` CHANGELOG](transports/noise/CHANGELOG.md)
2626
- [`libp2p-plaintext` CHANGELOG](transports/plaintext/CHANGELOG.md)
2727
- [`libp2p-pnet` CHANGELOG](transports/pnet/CHANGELOG.md)
28+
- [`libp2p-quic` CHANGELOG](transports/quic/CHANGELOG.md)
2829
- [`libp2p-tcp` CHANGELOG](transports/tcp/CHANGELOG.md)
2930
- [`libp2p-uds` CHANGELOG](transports/uds/CHANGELOG.md)
3031
- [`libp2p-wasm-ext` CHANGELOG](transports/wasm-ext/CHANGELOG.md)
@@ -47,6 +48,7 @@
4748
# 0.50.0 - [unreleased]
4849

4950
- Introduce [`libp2p-tls` `v0.1.0-alpha`](transports/tls/CHANGELOG.md#010-alpha). See [PR 2945].
51+
- Introduce [`libp2p-quic` `v0.7.0-alpha`](transports/quic/CHANGELOG.md#070-alpha). See [PR 2289].
5052
- Remove deprecated features: `tcp-tokio`, `mdns-tokio`, `dns-tokio`, `tcp-async-io`, `mdns-async-io`, `dns-async-std`.
5153
See [PR 3001].
5254
- Introduce [`libp2p-tls` `v0.1.0`](transports/tls/CHANGELOG.md#010). See [PR 2945].
@@ -82,6 +84,7 @@
8284
[PR 2945]: https://github.com/libp2p/rust-libp2p/pull/2945
8385
[PR 3001]: https://github.com/libp2p/rust-libp2p/pull/3001
8486
[PR 2945]: https://github.com/libp2p/rust-libp2p/pull/2945
87+
[PR 2289]: https://github.com/libp2p/rust-libp2p/pull/2289
8588
[PR 3055]: https://github.com/libp2p/rust-libp2p/pull/3055
8689

8790
# 0.49.0

Cargo.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ full = [
2929
"ping",
3030
"plaintext",
3131
"pnet",
32+
"quic",
3233
"macros",
3334
"relay",
3435
"rendezvous",
@@ -46,7 +47,7 @@ full = [
4647
"websocket",
4748
"yamux",
4849
]
49-
async-std = ["libp2p-mdns?/async-io", "libp2p-tcp?/async-io", "libp2p-dns?/async-std"]
50+
async-std = ["libp2p-mdns?/async-io", "libp2p-tcp?/async-io", "libp2p-dns?/async-std", "libp2p-quic?/async-std"]
5051
autonat = ["dep:libp2p-autonat"]
5152
dcutr = ["dep:libp2p-dcutr", "libp2p-metrics?/dcutr"]
5253
deflate = ["dep:libp2p-deflate"]
@@ -65,14 +66,15 @@ noise = ["dep:libp2p-noise"]
6566
ping = ["dep:libp2p-ping", "libp2p-metrics?/ping"]
6667
plaintext = ["dep:libp2p-plaintext"]
6768
pnet = ["dep:libp2p-pnet"]
69+
quic = ["dep:libp2p-quic"]
6870
relay = ["dep:libp2p-relay", "libp2p-metrics?/relay"]
6971
rendezvous = ["dep:libp2p-rendezvous"]
7072
request-response = ["dep:libp2p-request-response"]
7173
rsa = ["libp2p-core/rsa"]
7274
secp256k1 = ["libp2p-core/secp256k1"]
7375
serde = ["libp2p-core/serde", "libp2p-kad?/serde", "libp2p-gossipsub?/serde"]
7476
tcp = ["dep:libp2p-tcp"]
75-
tokio = ["libp2p-mdns?/tokio", "libp2p-tcp?/tokio", "libp2p-dns?/tokio"]
77+
tokio = ["libp2p-mdns?/tokio", "libp2p-tcp?/tokio", "libp2p-dns?/tokio", "libp2p-quic?/tokio"]
7678
uds = ["dep:libp2p-uds"]
7779
wasm-bindgen = ["futures-timer/wasm-bindgen", "instant/wasm-bindgen", "getrandom/js"]
7880
wasm-ext = ["dep:libp2p-wasm-ext"]
@@ -115,6 +117,7 @@ smallvec = "1.6.1"
115117
libp2p-deflate = { version = "0.38.0", path = "transports/deflate", optional = true }
116118
libp2p-dns = { version = "0.38.0", path = "transports/dns", optional = true }
117119
libp2p-mdns = { version = "0.42.0", path = "protocols/mdns", optional = true }
120+
libp2p-quic = { version = "0.7.0-alpha", path = "transports/quic", optional = true }
118121
libp2p-tcp = { version = "0.38.0", path = "transports/tcp", optional = true }
119122
libp2p-websocket = { version = "0.40.0", path = "transports/websocket", optional = true }
120123
libp2p-tls = { version = "0.1.0-alpha", path = "transports/tls", optional = true }
@@ -160,6 +163,7 @@ members = [
160163
"transports/tls",
161164
"transports/plaintext",
162165
"transports/pnet",
166+
"transports/quic",
163167
"transports/tcp",
164168
"transports/uds",
165169
"transports/websocket",

src/lib.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,12 @@ pub use libp2p_plaintext as plaintext;
9393
#[cfg(feature = "pnet")]
9494
#[doc(inline)]
9595
pub use libp2p_pnet as pnet;
96+
#[cfg(feature = "quic")]
97+
#[cfg(not(any(target_os = "emscripten", target_os = "wasi", target_os = "unknown")))]
98+
pub mod quic {
99+
#[doc(inline)]
100+
pub use libp2p_quic::*;
101+
}
96102
#[cfg(feature = "relay")]
97103
#[doc(inline)]
98104
pub use libp2p_relay as relay;

transports/quic/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# 0.7.0-alpha [unreleased]
2+
3+
- Initial alpha release.

transports/quic/Cargo.toml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
[package]
2+
name = "libp2p-quic"
3+
version = "0.7.0-alpha"
4+
authors = ["Parity Technologies <[email protected]>"]
5+
edition = "2021"
6+
description = "TLS based QUIC transport implementation for libp2p"
7+
repository = "https://github.com/libp2p/rust-libp2p"
8+
license = "MIT"
9+
10+
[dependencies]
11+
async-std = { version = "1.12.0", default-features = false, optional = true }
12+
bytes = "1.2.1"
13+
futures = "0.3.15"
14+
futures-timer = "3.0.2"
15+
if-watch = "3.0.0"
16+
libp2p-core = { version = "0.38.0", path = "../../core" }
17+
libp2p-tls = { version = "0.1.0-alpha", path = "../tls" }
18+
log = "0.4"
19+
parking_lot = "0.12.0"
20+
quinn-proto = { version = "0.9.0", default-features = false, features = ["tls-rustls"] }
21+
rand = "0.8.5"
22+
rustls = { version = "0.20.2", default-features = false }
23+
thiserror = "1.0.26"
24+
tokio = { version = "1.21.1", default-features = false, features = ["net", "rt"], optional = true }
25+
26+
[features]
27+
tokio = ["dep:tokio", "if-watch/tokio"]
28+
async-std = ["dep:async-std", "if-watch/smol"]
29+
30+
# Passing arguments to the docsrs builder in order to properly document cfg's.
31+
# More information: https://docs.rs/about/builds#cross-compiling
32+
[package.metadata.docs.rs]
33+
all-features = true
34+
rustdoc-args = ["--cfg", "docsrs"]
35+
rustc-args = ["--cfg", "docsrs"]
36+
37+
[dev-dependencies]
38+
async-std = { version = "1.12.0", features = ["attributes"] }
39+
env_logger = "0.9.0"
40+
libp2p = { path = "../..", features = ["tcp", "yamux", "noise", "async-std"] }
41+
libp2p-muxer-test-harness = { path = "../../muxers/test-harness" }
42+
quickcheck = "1"
43+
tokio = { version = "1.21.1", features = ["macros", "rt-multi-thread", "time"] }
44+
45+
[[test]]
46+
name = "stream_compliance"
47+
required-features = ["async-std"]

0 commit comments

Comments
 (0)