From cbdbaa836e1159fb4e8b20e76c32f1af5ec66926 Mon Sep 17 00:00:00 2001 From: Max Inden Date: Thu, 17 Aug 2023 09:54:29 +0200 Subject: [PATCH] feat(quic): promote to stable release - Cut a stable release of `libp2p-quic`. - Export `libp2p-quic` as `libp2p::quic`. - Update examples to use `libp2p-quic` through `libp2p`. Pull-Request: #4325. --- Cargo.lock | 9 +++------ Cargo.toml | 2 +- examples/chat-example/Cargo.toml | 3 +-- examples/chat-example/src/main.rs | 3 +-- examples/dcutr/Cargo.toml | 3 +-- examples/dcutr/src/main.rs | 3 +-- examples/relay-server/Cargo.toml | 3 +-- examples/relay-server/src/main.rs | 3 +-- interop-tests/Cargo.toml | 3 +-- interop-tests/src/arch.rs | 3 +-- libp2p/CHANGELOG.md | 4 ++++ libp2p/Cargo.toml | 9 ++++++--- libp2p/src/lib.rs | 3 +++ transports/quic/CHANGELOG.md | 4 ++++ transports/quic/Cargo.toml | 2 +- 15 files changed, 30 insertions(+), 27 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 19c99e8d..459afe3e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -831,7 +831,6 @@ dependencies = [ "env_logger 0.10.0", "futures", "libp2p", - "libp2p-quic", ] [[package]] @@ -1309,7 +1308,6 @@ dependencies = [ "futures", "futures-timer", "libp2p", - "libp2p-quic", "log", ] @@ -2354,7 +2352,6 @@ dependencies = [ "instant", "libp2p", "libp2p-mplex", - "libp2p-quic", "libp2p-webrtc", "log", "mime_guess", @@ -2512,7 +2509,7 @@ checksum = "7fc7aa29613bd6a620df431842069224d8bc9011086b1db4c0e0cd47fa03ec9a" [[package]] name = "libp2p" -version = "0.52.2" +version = "0.52.3" dependencies = [ "async-std", "async-trait", @@ -2543,6 +2540,7 @@ dependencies = [ "libp2p-ping", "libp2p-plaintext", "libp2p-pnet", + "libp2p-quic", "libp2p-relay", "libp2p-rendezvous", "libp2p-request-response", @@ -3058,7 +3056,7 @@ dependencies = [ [[package]] name = "libp2p-quic" -version = "0.9.2-alpha" +version = "0.9.2" dependencies = [ "async-std", "bytes", @@ -4610,7 +4608,6 @@ dependencies = [ "env_logger 0.10.0", "futures", "libp2p", - "libp2p-quic", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index fb503a12..03b38330 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -85,7 +85,7 @@ libp2p-perf = { version = "0.2.0", path = "protocols/perf" } libp2p-ping = { version = "0.43.0", path = "protocols/ping" } libp2p-plaintext = { version = "0.40.0", path = "transports/plaintext" } libp2p-pnet = { version = "0.23.0", path = "transports/pnet" } -libp2p-quic = { version = "0.9.2-alpha", path = "transports/quic" } +libp2p-quic = { version = "0.9.2", path = "transports/quic" } libp2p-relay = { version = "0.16.1", path = "protocols/relay" } libp2p-rendezvous = { version = "0.13.0", path = "protocols/rendezvous" } libp2p-request-response = { version = "0.25.1", path = "protocols/request-response" } diff --git a/examples/chat-example/Cargo.toml b/examples/chat-example/Cargo.toml index 1d865711..cfc417cf 100644 --- a/examples/chat-example/Cargo.toml +++ b/examples/chat-example/Cargo.toml @@ -10,5 +10,4 @@ async-std = { version = "1.12", features = ["attributes"] } async-trait = "0.1" env_logger = "0.10.0" futures = "0.3.28" -libp2p = { path = "../../libp2p", features = ["async-std", "gossipsub", "mdns", "noise", "macros", "tcp", "yamux"] } -libp2p-quic = { path = "../../transports/quic", features = ["async-std"] } +libp2p = { path = "../../libp2p", features = ["async-std", "gossipsub", "mdns", "noise", "macros", "tcp", "yamux", "quic"] } diff --git a/examples/chat-example/src/main.rs b/examples/chat-example/src/main.rs index 9dc2d92a..95a16f38 100644 --- a/examples/chat-example/src/main.rs +++ b/examples/chat-example/src/main.rs @@ -24,12 +24,11 @@ use async_std::io; use futures::{future::Either, prelude::*, select}; use libp2p::{ core::{muxing::StreamMuxerBox, transport::OrTransport, upgrade}, - gossipsub, identity, mdns, noise, + gossipsub, identity, mdns, noise, quic, swarm::NetworkBehaviour, swarm::{SwarmBuilder, SwarmEvent}, tcp, yamux, PeerId, Transport, }; -use libp2p_quic as quic; use std::collections::hash_map::DefaultHasher; use std::error::Error; use std::hash::{Hash, Hasher}; diff --git a/examples/dcutr/Cargo.toml b/examples/dcutr/Cargo.toml index 38394ee3..7a13dd23 100644 --- a/examples/dcutr/Cargo.toml +++ b/examples/dcutr/Cargo.toml @@ -10,6 +10,5 @@ clap = { version = "4.3.21", features = ["derive"] } env_logger = "0.10.0" futures = "0.3.28" futures-timer = "3.0" -libp2p = { path = "../../libp2p", features = ["async-std", "dns", "dcutr", "identify", "macros", "noise", "ping", "relay", "rendezvous", "tcp", "tokio", "yamux"] } -libp2p-quic = { path = "../../transports/quic", features = ["async-std"] } +libp2p = { path = "../../libp2p", features = ["async-std", "dns", "dcutr", "identify", "macros", "noise", "ping", "quic", "relay", "rendezvous", "tcp", "tokio", "yamux"] } log = "0.4" diff --git a/examples/dcutr/src/main.rs b/examples/dcutr/src/main.rs index 8359bb19..8837df78 100644 --- a/examples/dcutr/src/main.rs +++ b/examples/dcutr/src/main.rs @@ -35,11 +35,10 @@ use libp2p::{ }, dcutr, dns::DnsConfig, - identify, identity, noise, ping, relay, + identify, identity, noise, ping, quic, relay, swarm::{NetworkBehaviour, SwarmBuilder, SwarmEvent}, tcp, yamux, PeerId, }; -use libp2p_quic as quic; use log::info; use std::error::Error; use std::str::FromStr; diff --git a/examples/relay-server/Cargo.toml b/examples/relay-server/Cargo.toml index 296b50d3..62d3cc0a 100644 --- a/examples/relay-server/Cargo.toml +++ b/examples/relay-server/Cargo.toml @@ -11,5 +11,4 @@ async-std = { version = "1.12", features = ["attributes"] } async-trait = "0.1" env_logger = "0.10.0" futures = "0.3.28" -libp2p = { path = "../../libp2p", features = ["async-std", "noise", "macros", "ping", "tcp", "identify", "yamux", "relay"] } -libp2p-quic = { path = "../../transports/quic", features = ["async-std"] } +libp2p = { path = "../../libp2p", features = ["async-std", "noise", "macros", "ping", "tcp", "identify", "yamux", "relay", "quic"] } diff --git a/examples/relay-server/src/main.rs b/examples/relay-server/src/main.rs index 6a1d956b..7526a076 100644 --- a/examples/relay-server/src/main.rs +++ b/examples/relay-server/src/main.rs @@ -31,11 +31,10 @@ use libp2p::{ core::{Multiaddr, Transport}, identify, identity, identity::PeerId, - noise, ping, relay, + noise, ping, quic, relay, swarm::{NetworkBehaviour, SwarmBuilder, SwarmEvent}, tcp, }; -use libp2p_quic as quic; use std::error::Error; use std::net::{Ipv4Addr, Ipv6Addr}; diff --git a/interop-tests/Cargo.toml b/interop-tests/Cargo.toml index d03c0403..1c9ef732 100644 --- a/interop-tests/Cargo.toml +++ b/interop-tests/Cargo.toml @@ -19,8 +19,7 @@ rand = "0.8.5" [target.'cfg(not(target_arch = "wasm32"))'.dependencies] axum = "0.6" -libp2p = { path = "../libp2p", features = ["ping", "noise", "tls", "rsa", "macros", "websocket", "tokio", "yamux", "tcp", "dns", "identify"] } -libp2p-quic = { workspace = true, features = ["tokio"] } +libp2p = { path = "../libp2p", features = ["ping", "noise", "tls", "rsa", "macros", "websocket", "tokio", "yamux", "tcp", "dns", "identify", "quic"] } libp2p-webrtc = { workspace = true, features = ["tokio"] } libp2p-mplex = { path = "../muxers/mplex" } mime_guess = "2.0" diff --git a/interop-tests/src/arch.rs b/interop-tests/src/arch.rs index 2f4a7495..2b2181f2 100644 --- a/interop-tests/src/arch.rs +++ b/interop-tests/src/arch.rs @@ -26,9 +26,8 @@ pub(crate) mod native { use libp2p::identity::Keypair; use libp2p::swarm::{NetworkBehaviour, SwarmBuilder}; use libp2p::websocket::WsConfig; - use libp2p::{noise, tcp, tls, yamux, PeerId, Transport as _}; + use libp2p::{noise, quic, tcp, tls, yamux, PeerId, Transport as _}; use libp2p_mplex as mplex; - use libp2p_quic as quic; use libp2p_webrtc as webrtc; use redis::AsyncCommands; diff --git a/libp2p/CHANGELOG.md b/libp2p/CHANGELOG.md index 50774aaa..642d4103 100644 --- a/libp2p/CHANGELOG.md +++ b/libp2p/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.52.3 - unreleased + +- Add `libp2p-quic` stable release. + ## 0.52.2 - Include gossipsub when compiling for wasm. diff --git a/libp2p/Cargo.toml b/libp2p/Cargo.toml index e057c9e8..f02ec1c6 100644 --- a/libp2p/Cargo.toml +++ b/libp2p/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p" edition = "2021" rust-version = "1.65.0" description = "Peer-to-peer networking library" -version = "0.52.2" +version = "0.52.3" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" @@ -33,6 +33,7 @@ full = [ "ping", "plaintext", "pnet", + "quic", "relay", "rendezvous", "request-response", @@ -51,7 +52,7 @@ full = [ "yamux", ] -async-std = ["libp2p-swarm/async-std", "libp2p-mdns?/async-io", "libp2p-tcp?/async-io", "libp2p-dns?/async-std"] +async-std = ["libp2p-swarm/async-std", "libp2p-mdns?/async-io", "libp2p-tcp?/async-io", "libp2p-dns?/async-std", "libp2p-quic?/async-std"] autonat = ["dep:libp2p-autonat"] cbor = ["libp2p-request-response?/cbor"] dcutr = ["dep:libp2p-dcutr", "libp2p-metrics?/dcutr"] @@ -72,6 +73,7 @@ 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"] @@ -80,7 +82,7 @@ secp256k1 = ["libp2p-identity/secp256k1"] serde = ["libp2p-core/serde", "libp2p-kad?/serde", "libp2p-gossipsub?/serde"] tcp = ["dep:libp2p-tcp"] tls = ["dep:libp2p-tls"] -tokio = ["libp2p-swarm/tokio", "libp2p-mdns?/tokio", "libp2p-tcp?/tokio", "libp2p-dns?/tokio"] +tokio = ["libp2p-swarm/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", "libp2p-swarm/wasm-bindgen", "libp2p-gossipsub?/wasm-bindgen"] wasm-ext = ["dep:libp2p-wasm-ext"] @@ -127,6 +129,7 @@ libp2p-deflate = { workspace = true, optional = true } libp2p-dns = { workspace = true, optional = true } libp2p-mdns = { workspace = true, optional = true } libp2p-memory-connection-limits = { workspace = true, optional = true } +libp2p-quic = { workspace = true, optional = true } libp2p-tcp = { workspace = true, optional = true } libp2p-tls = { workspace = true, optional = true } libp2p-uds = { workspace = true, optional = true } diff --git a/libp2p/src/lib.rs b/libp2p/src/lib.rs index 9ec1fe48..349427ff 100644 --- a/libp2p/src/lib.rs +++ b/libp2p/src/lib.rs @@ -98,6 +98,9 @@ pub use libp2p_plaintext as plaintext; #[cfg(feature = "pnet")] #[doc(inline)] pub use libp2p_pnet as pnet; +#[cfg(feature = "quic")] +#[cfg(not(target_arch = "wasm32"))] +pub use libp2p_quic as quic; #[cfg(feature = "relay")] #[doc(inline)] pub use libp2p_relay as relay; diff --git a/transports/quic/CHANGELOG.md b/transports/quic/CHANGELOG.md index 66a6dec3..c7da2895 100644 --- a/transports/quic/CHANGELOG.md +++ b/transports/quic/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.9.2 - unreleased + +- Cut stable release. + ## 0.9.2-alpha - Add support for reusing an existing socket when dialing localhost address. diff --git a/transports/quic/Cargo.toml b/transports/quic/Cargo.toml index 2500e5d7..13fbe9bb 100644 --- a/transports/quic/Cargo.toml +++ b/transports/quic/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "libp2p-quic" -version = "0.9.2-alpha" +version = "0.9.2" authors = ["Parity Technologies "] edition = "2021" rust-version = { workspace = true }