Refine boxing during transport construction. (#1794)

* Rework boxing during transport construction.

* Cleanup

* Fix chat-tokio example.

* Update changelogs and versions.
This commit is contained in:
Roman Borschel
2020-10-16 16:53:02 +02:00
committed by GitHub
parent 2dbf834d10
commit dc56d44edb
51 changed files with 369 additions and 331 deletions

View File

@@ -1,3 +1,7 @@
# 0.23.0 [unreleased]
- Bump `libp2p-core` dependency.
# 0.22.0 [2020-09-09]
- Bump `libp2p-core` dependency.

View File

@@ -2,7 +2,7 @@
name = "libp2p-deflate"
edition = "2018"
description = "Deflate encryption protocol for libp2p"
version = "0.22.0"
version = "0.23.0"
authors = ["Parity Technologies <admin@parity.io>"]
license = "MIT"
repository = "https://github.com/libp2p/rust-libp2p"
@@ -11,7 +11,7 @@ categories = ["network-programming", "asynchronous"]
[dependencies]
futures = "0.3.1"
libp2p-core = { version = "0.22.0", path = "../../core" }
libp2p-core = { version = "0.23.0", path = "../../core" }
flate2 = "1.0"
[dev-dependencies]

View File

@@ -13,8 +13,8 @@ categories = ["network-programming", "asynchronous"]
cuckoofilter = "0.5.0"
fnv = "1.0"
futures = "0.3.1"
libp2p-core = { version = "0.22.0", path = "../../core" }
libp2p-swarm = { version = "0.22.0", path = "../../swarm" }
libp2p-core = { version = "0.23.0", path = "../../core" }
libp2p-swarm = { version = "0.23.0", path = "../../swarm" }
log = "0.4"
prost = "0.6.1"
rand = "0.7"

View File

@@ -1,4 +1,4 @@
# 0.22.1 [unreleased]
# 0.23.0 [unreleased]
- Update dependencies.

View File

@@ -2,7 +2,7 @@
name = "libp2p-gossipsub"
edition = "2018"
description = "Gossipsub protocol for libp2p"
version = "0.22.1"
version = "0.23.0"
authors = ["Age Manning <Age@AgeManning.com>"]
license = "MIT"
repository = "https://github.com/libp2p/rust-libp2p"
@@ -10,8 +10,8 @@ keywords = ["peer-to-peer", "libp2p", "networking"]
categories = ["network-programming", "asynchronous"]
[dependencies]
libp2p-swarm = { version = "0.22.0", path = "../../swarm" }
libp2p-core = { version = "0.22.0", path = "../../core" }
libp2p-swarm = { version = "0.23.0", path = "../../swarm" }
libp2p-core = { version = "0.23.0", path = "../../core" }
bytes = "0.5.4"
byteorder = "1.3.2"
fnv = "1.0.6"

View File

@@ -150,7 +150,8 @@ fn build_node() -> (Multiaddr, Swarm<Gossipsub>) {
.authenticate(PlainText2Config {
local_public_key: public_key.clone(),
})
.multiplex(yamux::Config::default());
.multiplex(yamux::Config::default())
.boxed();
let peer_id = public_key.clone().into_peer_id();

View File

@@ -1,3 +1,7 @@
# 0.23.0 [unreleased]
- Update `libp2p-swarm` and `libp2p-core`.
# 0.22.0 [2020-09-09]
- Update `libp2p-swarm` and `libp2p-core`.

View File

@@ -2,7 +2,7 @@
name = "libp2p-identify"
edition = "2018"
description = "Nodes identifcation protocol for libp2p"
version = "0.22.0"
version = "0.23.0"
authors = ["Parity Technologies <admin@parity.io>"]
license = "MIT"
repository = "https://github.com/libp2p/rust-libp2p"
@@ -11,8 +11,8 @@ categories = ["network-programming", "asynchronous"]
[dependencies]
futures = "0.3.1"
libp2p-core = { version = "0.22.0", path = "../../core" }
libp2p-swarm = { version = "0.22.0", path = "../../swarm" }
libp2p-core = { version = "0.23.0", path = "../../core" }
libp2p-swarm = { version = "0.23.0", path = "../../swarm" }
log = "0.4.1"
prost = "0.6.1"
smallvec = "1.0"

View File

@@ -273,7 +273,8 @@ mod tests {
use libp2p_core::{
identity,
PeerId,
muxing::StreamMuxer,
muxing::StreamMuxerBox,
transport,
Transport,
upgrade
};
@@ -281,15 +282,8 @@ mod tests {
use libp2p_tcp::TcpConfig;
use libp2p_swarm::{Swarm, SwarmEvent};
use libp2p_mplex::MplexConfig;
use std::{fmt, io};
fn transport() -> (identity::PublicKey, impl Transport<
Output = (PeerId, impl StreamMuxer<Substream = impl Send, OutboundSubstream = impl Send, Error = impl Into<io::Error>>),
Listener = impl Send,
ListenerUpgrade = impl Send,
Dial = impl Send,
Error = impl fmt::Debug
> + Clone) {
fn transport() -> (identity::PublicKey, transport::Boxed<(PeerId, StreamMuxerBox)>) {
let id_keys = identity::Keypair::generate_ed25519();
let noise_keys = noise::Keypair::<noise::X25519Spec>::new().into_authentic(&id_keys).unwrap();
let pubkey = id_keys.public();
@@ -297,7 +291,8 @@ mod tests {
.nodelay(true)
.upgrade(upgrade::Version::V1)
.authenticate(noise::NoiseConfig::xx(noise_keys).into_authenticated())
.multiplex(MplexConfig::new());
.multiplex(MplexConfig::new())
.boxed();
(pubkey, transport)
}

View File

@@ -1,4 +1,6 @@
# 0.23.1 [unreleased]
# 0.24.0 [unreleased]
- Update `libp2p-core` and `libp2p-swarm`.
- Update `sha2` dependency.

View File

@@ -2,7 +2,7 @@
name = "libp2p-kad"
edition = "2018"
description = "Kademlia protocol for libp2p"
version = "0.23.1"
version = "0.24.0"
authors = ["Parity Technologies <admin@parity.io>"]
license = "MIT"
repository = "https://github.com/libp2p/rust-libp2p"
@@ -17,8 +17,8 @@ fnv = "1.0"
futures_codec = "0.4"
futures = "0.3.1"
log = "0.4"
libp2p-core = { version = "0.22.0", path = "../../core" }
libp2p-swarm = { version = "0.22.0", path = "../../swarm" }
libp2p-core = { version = "0.23.0", path = "../../core" }
libp2p-swarm = { version = "0.23.0", path = "../../swarm" }
multihash = "0.11.0"
prost = "0.6.1"
rand = "0.7.2"

View File

@@ -61,7 +61,8 @@ fn build_node_with_config(cfg: KademliaConfig) -> (Multiaddr, TestSwarm) {
let transport = MemoryTransport::default()
.upgrade(upgrade::Version::V1)
.authenticate(noise::NoiseConfig::xx(noise_keys).into_authenticated())
.multiplex(yamux::Config::default());
.multiplex(yamux::Config::default())
.boxed();
let local_id = local_public_key.clone().into_peer_id();
let store = MemoryStore::new(local_id.clone());

View File

@@ -1,4 +1,6 @@
# 0.22.1 [unreleased]
# 0.23.0 [unreleased]
- Update `libp2p-swarm` and `libp2p-core`.
- Double receive buffer to 4KiB. [PR 1779](https://github.com/libp2p/rust-libp2p/pull/1779/files).

View File

@@ -1,7 +1,7 @@
[package]
name = "libp2p-mdns"
edition = "2018"
version = "0.22.1"
version = "0.23.0"
description = "Implementation of the libp2p mDNS discovery method"
authors = ["Parity Technologies <admin@parity.io>"]
license = "MIT"
@@ -16,8 +16,8 @@ dns-parser = "0.8"
either = "1.5.3"
futures = "0.3.1"
lazy_static = "1.2"
libp2p-core = { version = "0.22.0", path = "../../core" }
libp2p-swarm = { version = "0.22.0", path = "../../swarm" }
libp2p-core = { version = "0.23.0", path = "../../core" }
libp2p-swarm = { version = "0.23.0", path = "../../swarm" }
log = "0.4"
net2 = "0.2"
rand = "0.7"

View File

@@ -1,4 +1,4 @@
# 0.24.1 [unreleased]
# 0.25.0 [unreleased]
- Update dependencies.

View File

@@ -1,7 +1,7 @@
[package]
name = "libp2p-noise"
description = "Cryptographic handshake protocol using the noise framework."
version = "0.24.1"
version = "0.25.0"
authors = ["Parity Technologies <admin@parity.io>"]
license = "MIT"
repository = "https://github.com/libp2p/rust-libp2p"
@@ -12,7 +12,7 @@ bytes = "0.5"
curve25519-dalek = "3.0.0"
futures = "0.3.1"
lazy_static = "1.2"
libp2p-core = { version = "0.22.0", path = "../../core" }
libp2p-core = { version = "0.23.0", path = "../../core" }
log = "0.4"
prost = "0.6.1"
rand = "0.7.2"

View File

@@ -1,4 +1,6 @@
# 0.22.1 [unreleased]
# 0.23.0 [unreleased]
- Update `libp2p-swarm` and `libp2p-core`.
- Ensure the outbound ping is flushed before awaiting
the response. Otherwise the behaviour depends on

View File

@@ -2,7 +2,7 @@
name = "libp2p-ping"
edition = "2018"
description = "Ping protocol for libp2p"
version = "0.22.1"
version = "0.23.0"
authors = ["Parity Technologies <admin@parity.io>"]
license = "MIT"
repository = "https://github.com/libp2p/rust-libp2p"
@@ -11,8 +11,8 @@ categories = ["network-programming", "asynchronous"]
[dependencies]
futures = "0.3.1"
libp2p-core = { version = "0.22.0", path = "../../core" }
libp2p-swarm = { version = "0.22.0", path = "../../swarm" }
libp2p-core = { version = "0.23.0", path = "../../core" }
libp2p-swarm = { version = "0.23.0", path = "../../swarm" }
log = "0.4.1"
rand = "0.7.2"
void = "1.0"

View File

@@ -37,7 +37,7 @@ use libp2p_yamux as yamux;
use futures::{prelude::*, channel::mpsc};
use quickcheck::*;
use rand::prelude::*;
use std::{io, num::NonZeroU8, time::Duration};
use std::{num::NonZeroU8, time::Duration};
#[test]
fn ping_pong() {
@@ -196,10 +196,7 @@ fn max_failures() {
fn mk_transport(muxer: MuxerChoice) -> (
PeerId,
transport::Boxed<
(PeerId, StreamMuxerBox),
io::Error
>
transport::Boxed<(PeerId, StreamMuxerBox)>
) {
let id_keys = identity::Keypair::generate_ed25519();
let peer_id = id_keys.public().into_peer_id();

View File

@@ -13,7 +13,7 @@ categories = ["network-programming", "asynchronous"]
bytes = "0.5"
futures = "0.3.1"
futures_codec = "0.4.0"
libp2p-core = { version = "0.22.0", path = "../../core" }
libp2p-core = { version = "0.23.0", path = "../../core" }
log = "0.4.8"
prost = "0.6.1"
unsigned-varint = { version = "0.5.1", features = ["futures-codec"] }

View File

@@ -13,8 +13,8 @@ categories = ["network-programming", "asynchronous"]
async-trait = "0.1"
bytes = "0.5.6"
futures = "0.3.1"
libp2p-core = { version = "0.22.0", path = "../../core" }
libp2p-swarm = { version = "0.22.0", path = "../../swarm" }
libp2p-core = { version = "0.23.0", path = "../../core" }
libp2p-swarm = { version = "0.23.0", path = "../../swarm" }
log = "0.4.11"
lru = "0.6"
minicbor = { version = "0.6", features = ["std", "derive"] }

View File

@@ -213,7 +213,7 @@ fn ping_protocol_throttled() {
let () = async_std::task::block_on(peer2);
}
fn mk_transport() -> (PeerId, transport::Boxed<(PeerId, StreamMuxerBox), io::Error>) {
fn mk_transport() -> (PeerId, transport::Boxed<(PeerId, StreamMuxerBox)>) {
let id_keys = identity::Keypair::generate_ed25519();
let peer_id = id_keys.public().into_peer_id();
let noise_keys = Keypair::<X25519Spec>::new().into_authentic(&id_keys).unwrap();

View File

@@ -1,4 +1,4 @@
# 0.22.1 [unreleased]
# 0.23.0 [unreleased]
- Update dependencies.

View File

@@ -2,7 +2,7 @@
name = "libp2p-secio"
edition = "2018"
description = "Secio encryption protocol for libp2p"
version = "0.22.1"
version = "0.23.0"
authors = ["Parity Technologies <admin@parity.io>"]
license = "MIT"
repository = "https://github.com/libp2p/rust-libp2p"
@@ -19,7 +19,7 @@ ctr = "0.3"
futures = "0.3.1"
hmac = "0.9.0"
lazy_static = "1.2.0"
libp2p-core = { version = "0.22.0", path = "../../core" }
libp2p-core = { version = "0.23.0", path = "../../core" }
log = "0.4.6"
prost = "0.6.1"
pin-project = "1.0.0"