*: Unfiy how we depend on crates across the workspace (#2886)

This commit is contained in:
Thomas Eizinger
2022-09-19 17:32:02 +10:00
committed by GitHub
parent 2025de3ef0
commit 45faefa36c
37 changed files with 87 additions and 121 deletions

View File

@ -175,4 +175,4 @@ required-features = ["gossipsub"]
[[example]]
name = "ipfs-private"
required-features = ["gossipsub"]
required-features = ["gossipsub", "pnet", "yamux", "ping", "noise", "tcp-async-io", "identify"]

View File

@ -46,9 +46,7 @@ ring = { version = "0.16.9", features = ["alloc", "std"], default-features = fal
async-std = { version = "1.6.2", features = ["attributes"] }
base64 = "0.13.0"
criterion = "0.4"
libp2p-mplex = { path = "../muxers/mplex" }
libp2p-noise = { path = "../transports/noise" }
libp2p-tcp = { path = "../transports/tcp" }
libp2p = { path = "../", default-features = false, features = ["mplex", "noise"] }
multihash = { version = "0.16", default-features = false, features = ["arb"] }
quickcheck = "0.9.0"
rand07 = { package = "rand", version = "0.7" }

View File

@ -19,11 +19,11 @@
// DEALINGS IN THE SOFTWARE.
use futures::prelude::*;
use libp2p_core::identity;
use libp2p_core::transport::{MemoryTransport, Transport};
use libp2p_core::upgrade::{self, InboundUpgrade, OutboundUpgrade, UpgradeInfo};
use libp2p_mplex::MplexConfig;
use libp2p_noise as noise;
use libp2p::core::identity;
use libp2p::core::transport::{MemoryTransport, Transport};
use libp2p::core::upgrade::{self, InboundUpgrade, OutboundUpgrade, UpgradeInfo};
use libp2p::mplex::MplexConfig;
use libp2p::noise;
use multiaddr::{Multiaddr, Protocol};
use rand::random;
use std::{io, pin::Pin};

View File

@ -37,6 +37,7 @@
//! ```
use futures::StreamExt;
use libp2p::tcp::GenTcpConfig;
use libp2p::{
core::upgrade,
floodsub::{self, Floodsub, FloodsubEvent},
@ -56,7 +57,6 @@ use libp2p::{
PeerId,
Transport,
};
use libp2p_tcp::GenTcpConfig;
use std::error::Error;
use tokio::io::{self, AsyncBufReadExt};

View File

@ -33,6 +33,7 @@
//! to work, the ipfs node needs to be configured to use gossipsub.
use async_std::io;
use futures::{prelude::*, select};
use libp2p::tcp::GenTcpConfig;
use libp2p::{
core::{
either::EitherTransport, muxing::StreamMuxerBox, transport, transport::upgrade::Version,
@ -49,7 +50,6 @@ use libp2p::{
yamux::YamuxConfig,
Multiaddr, NetworkBehaviour, PeerId, Swarm, Transport,
};
use libp2p_tcp::GenTcpConfig;
use std::{env, error::Error, fs, path::Path, str::FromStr, time::Duration};
/// Builds the transport that serves as a common ground for all connections.

View File

@ -21,10 +21,7 @@ unsigned-varint = "0.7"
[dev-dependencies]
async-std = "1.6.2"
env_logger = "0.9"
libp2p-core = { path = "../../core", default-features = false }
libp2p-swarm = { path = "../../swarm", default-features = false }
libp2p-mplex = { path = "../../muxers/mplex" }
libp2p-plaintext = { path = "../../transports/plaintext" }
libp2p = { path = "../../", default-features = false, features = ["mplex", "plaintext"] }
quickcheck = "0.9.0"
rand = "0.7.2"
rw-stream-sink = { version = "0.3.0", path = "../../misc/rw-stream-sink" }

View File

@ -19,16 +19,16 @@
// DEALINGS IN THE SOFTWARE.
use futures::{channel::oneshot, prelude::*, ready};
use libp2p_core::{
use libp2p::core::{
identity,
multiaddr::Protocol,
muxing::StreamMuxerBox,
transport::{self, MemoryTransport},
upgrade, Multiaddr, PeerId, Transport,
};
use libp2p_mplex::MplexConfig;
use libp2p_plaintext::PlainText2Config;
use libp2p_swarm::{DummyBehaviour, Swarm, SwarmEvent};
use libp2p::mplex::MplexConfig;
use libp2p::plaintext::PlainText2Config;
use libp2p::swarm::{DummyBehaviour, Swarm, SwarmEvent};
use rand::random;
use std::task::Poll;

View File

@ -27,8 +27,7 @@ async-std = "1.7.0"
criterion = "0.4"
env_logger = "0.9"
futures = "0.3"
libp2p-tcp = { path = "../../transports/tcp" }
libp2p-plaintext = { path = "../../transports/plaintext" }
libp2p = { path = "../../", default-features = false, features = ["tcp-async-io", "plaintext", "mplex"] }
quickcheck = "0.9"
rand = "0.7"

View File

@ -26,13 +26,13 @@ use criterion::{black_box, criterion_group, criterion_main, Criterion, Throughpu
use futures::future::poll_fn;
use futures::prelude::*;
use futures::{channel::oneshot, future::join};
use libp2p_core::muxing::StreamMuxerExt;
use libp2p_core::{
use libp2p::core::muxing::StreamMuxerExt;
use libp2p::core::{
identity, multiaddr::multiaddr, muxing, transport, upgrade, Multiaddr, PeerId, Transport,
};
use libp2p_mplex as mplex;
use libp2p_plaintext::PlainText2Config;
use libp2p_tcp::GenTcpConfig;
use libp2p::mplex;
use libp2p::plaintext::PlainText2Config;
use libp2p::tcp::GenTcpConfig;
use std::pin::Pin;
use std::time::Duration;
@ -166,7 +166,7 @@ fn tcp_transport(split_send_size: usize) -> BenchTransport {
let mut mplex = mplex::MplexConfig::default();
mplex.set_split_send_size(split_send_size);
libp2p_tcp::TcpTransport::new(GenTcpConfig::default().nodelay(true))
libp2p::tcp::TcpTransport::new(GenTcpConfig::default().nodelay(true))
.upgrade(upgrade::Version::V1)
.authenticate(PlainText2Config { local_public_key })
.multiplex(mplex)

View File

@ -19,9 +19,9 @@
// DEALINGS IN THE SOFTWARE.
use futures::{channel::oneshot, prelude::*};
use libp2p_core::muxing::StreamMuxerExt;
use libp2p_core::{upgrade, Transport};
use libp2p_tcp::TcpTransport;
use libp2p::core::muxing::StreamMuxerExt;
use libp2p::core::{upgrade, Transport};
use libp2p::tcp::TcpTransport;
#[test]
fn async_write() {
@ -30,7 +30,7 @@ fn async_write() {
let (tx, rx) = oneshot::channel();
let bg_thread = async_std::task::spawn(async move {
let mplex = libp2p_mplex::MplexConfig::new();
let mplex = libp2p::mplex::MplexConfig::new();
let mut transport = TcpTransport::default()
.and_then(move |c, e| upgrade::apply(c, mplex, e, upgrade::Version::V1))
@ -67,7 +67,7 @@ fn async_write() {
});
async_std::task::block_on(async {
let mplex = libp2p_mplex::MplexConfig::new();
let mplex = libp2p::mplex::MplexConfig::new();
let mut transport = TcpTransport::default()
.and_then(move |c, e| upgrade::apply(c, mplex, e, upgrade::Version::V1));

View File

@ -19,9 +19,9 @@
// DEALINGS IN THE SOFTWARE.
use futures::{channel::oneshot, prelude::*};
use libp2p_core::muxing::StreamMuxerExt;
use libp2p_core::{upgrade, Transport};
use libp2p_tcp::TcpTransport;
use libp2p::core::muxing::StreamMuxerExt;
use libp2p::core::{upgrade, Transport};
use libp2p::tcp::TcpTransport;
#[test]
fn client_to_server_outbound() {

View File

@ -29,9 +29,4 @@ prost = "0.11"
async-std = { version = "1.10", features = ["attributes"] }
env_logger = "0.9"
clap = {version = "3.1.6", features = ["derive"]}
[dev-dependencies.libp2p]
path = "../../"
default-features = false
features = ["autonat", "dns-async-std", "identify", "mplex", "noise", "tcp-async-io", "websocket", "yamux"]
libp2p = { path = "../../", default-features = false, features = ["autonat", "dns-async-std", "identify", "mplex", "noise", "tcp-async-io", "websocket", "yamux"] }

View File

@ -20,6 +20,8 @@
use futures::{channel::oneshot, Future, FutureExt, StreamExt};
use futures_timer::Delay;
use libp2p::core::{ConnectedPoint, Endpoint};
use libp2p::swarm::DialError;
use libp2p::{
development_transport,
identity::Keypair,
@ -30,8 +32,6 @@ use libp2p::{
use libp2p_autonat::{
Behaviour, Config, Event, InboundProbeError, InboundProbeEvent, ResponseError,
};
use libp2p_core::{ConnectedPoint, Endpoint};
use libp2p_swarm::DialError;
use std::{num::NonZeroU32, time::Duration};
async fn init_swarm(config: Config) -> Swarm<Behaviour> {

View File

@ -30,10 +30,6 @@ prost-build = "0.11"
[dev-dependencies]
env_logger = "0.9.0"
libp2p = { path = "../..", default-features = false, features = ["dcutr", "relay", "plaintext", "identify", "tcp-async-io", "ping", "noise", "dns-async-std"] }
libp2p-identify = { path = "../identify" }
libp2p-plaintext = { path = "../../transports/plaintext" }
libp2p-relay = { path = "../relay" }
libp2p-yamux = { path = "../../muxers/yamux" }
libp2p = { path = "../..", default-features = false, features = ["dcutr", "relay", "plaintext", "identify", "tcp-async-io", "ping", "noise", "dns-async-std", "yamux"] }
rand = "0.7"
clap = {version = "3.1.6", features = ["derive"]}

View File

@ -101,7 +101,7 @@ fn main() -> Result<(), Box<dyn Error>> {
noise::NoiseAuthenticated::xx(&local_key)
.expect("Signing libp2p-noise static DH keypair failed."),
)
.multiplex(libp2p_yamux::YamuxConfig::default())
.multiplex(libp2p::yamux::YamuxConfig::default())
.boxed();
#[derive(NetworkBehaviour)]

View File

@ -33,8 +33,8 @@ use libp2p::dcutr;
use libp2p::plaintext::PlainText2Config;
use libp2p::relay::v2::client;
use libp2p::relay::v2::relay;
use libp2p::swarm::{AddressScore, NetworkBehaviour, Swarm, SwarmEvent};
use libp2p::NetworkBehaviour;
use libp2p_swarm::{AddressScore, NetworkBehaviour, Swarm, SwarmEvent};
use std::time::Duration;
#[test]
@ -144,7 +144,7 @@ where
let transport = transport
.upgrade(Version::V1)
.authenticate(PlainText2Config { local_public_key })
.multiplex(libp2p_yamux::YamuxConfig::default())
.multiplex(libp2p::yamux::YamuxConfig::default())
.boxed();
transport

View File

@ -36,10 +36,7 @@ prometheus-client = "0.18.0"
[dev-dependencies]
async-std = "1.6.3"
env_logger = "0.9.0"
libp2p-plaintext = { path = "../../transports/plaintext" }
libp2p-yamux = { path = "../../muxers/yamux" }
libp2p-mplex = { path = "../../muxers/mplex" }
libp2p-noise = { path = "../../transports/noise" }
libp2p = { path = "../../", default-features = false, features = ["plaintext", "yamux", "noise", "mplex", "gossipsub"] }
quickcheck = "0.9.2"
hex = "0.4.2"
derive_builder = "0.11.1"

View File

@ -99,8 +99,8 @@
//! // This is test transport (memory).
//! let transport = MemoryTransport::default()
//! .upgrade(libp2p_core::upgrade::Version::V1)
//! .authenticate(libp2p_noise::NoiseAuthenticated::xx(&local_key).unwrap())
//! .multiplex(libp2p_mplex::MplexConfig::new())
//! .authenticate(libp2p::noise::NoiseAuthenticated::xx(&local_key).unwrap())
//! .multiplex(libp2p::mplex::MplexConfig::new())
//! .boxed();
//!
//! // Create a Gossipsub topic

View File

@ -29,16 +29,16 @@ use std::{
};
use futures::StreamExt;
use libp2p_core::{
use libp2p::core::{
identity, multiaddr::Protocol, transport::MemoryTransport, upgrade, Multiaddr, Transport,
};
use libp2p_gossipsub::{
use libp2p::gossipsub::{
Gossipsub, GossipsubConfigBuilder, GossipsubEvent, IdentTopic as Topic, MessageAuthenticity,
ValidationMode,
};
use libp2p_plaintext::PlainText2Config;
use libp2p_swarm::{Swarm, SwarmEvent};
use libp2p_yamux as yamux;
use libp2p::plaintext::PlainText2Config;
use libp2p::swarm::{Swarm, SwarmEvent};
use libp2p::yamux;
struct Graph {
pub nodes: Vec<(Multiaddr, Swarm<Gossipsub>)>,
@ -177,9 +177,7 @@ fn build_node() -> (Multiaddr, Swarm<Gossipsub>) {
let mut addr: Multiaddr = Protocol::Memory(port).into();
swarm.listen_on(addr.clone()).unwrap();
addr = addr.with(libp2p_core::multiaddr::Protocol::P2p(
public_key.to_peer_id().into(),
));
addr = addr.with(Protocol::P2p(public_key.to_peer_id().into()));
(addr, swarm)
}

View File

@ -35,8 +35,7 @@ thiserror = "1"
[dev-dependencies]
env_logger = "0.9.0"
futures-timer = "3.0"
libp2p-noise = { path = "../../transports/noise" }
libp2p-yamux = { path = "../../muxers/yamux" }
libp2p = { path = "../../", default-features = false, features = ["noise", "yamux"] }
quickcheck = "0.9.0"
[build-dependencies]

View File

@ -27,6 +27,9 @@ use crate::record::{store::MemoryStore, Key};
use crate::K_VALUE;
use futures::{executor::block_on, future::poll_fn, prelude::*};
use futures_timer::Delay;
use libp2p::noise;
use libp2p::swarm::{Swarm, SwarmEvent};
use libp2p::yamux;
use libp2p_core::{
connection::{ConnectedPoint, ConnectionId},
identity,
@ -35,9 +38,6 @@ use libp2p_core::{
transport::MemoryTransport,
upgrade, Endpoint, PeerId, Transport,
};
use libp2p_noise as noise;
use libp2p_swarm::{Swarm, SwarmEvent};
use libp2p_yamux as yamux;
use quickcheck::*;
use rand::{random, rngs::StdRng, thread_rng, Rng, SeedableRng};
use std::{

View File

@ -22,8 +22,5 @@ void = "1.0"
[dev-dependencies]
async-std = "1.6.2"
libp2p-tcp = { path = "../../transports/tcp" }
libp2p-noise = { path = "../../transports/noise" }
libp2p-yamux = { path = "../../muxers/yamux" }
libp2p-mplex = { path = "../../muxers/mplex" }
libp2p = { path = "../../", default-features = false, features = ["tcp-async-io", "noise", "mplex", "yamux", "ping"] }
quickcheck = "0.9.0"

View File

@ -21,18 +21,18 @@
//! Integration tests for the `Ping` network behaviour.
use futures::{channel::mpsc, prelude::*};
use libp2p_core::{
use libp2p::core::{
identity,
muxing::StreamMuxerBox,
transport::{self, Transport},
upgrade, Multiaddr, PeerId,
};
use libp2p_mplex as mplex;
use libp2p_noise as noise;
use libp2p_ping as ping;
use libp2p_swarm::{DummyBehaviour, KeepAlive, Swarm, SwarmEvent};
use libp2p_tcp::{GenTcpConfig, TcpTransport};
use libp2p_yamux as yamux;
use libp2p::mplex;
use libp2p::noise;
use libp2p::ping;
use libp2p::swarm::{DummyBehaviour, KeepAlive, Swarm, SwarmEvent};
use libp2p::tcp::{GenTcpConfig, TcpTransport};
use libp2p::yamux;
use quickcheck::*;
use rand::prelude::*;
use std::{num::NonZeroU8, time::Duration};

View File

@ -34,11 +34,6 @@ prost-build = "0.11"
[dev-dependencies]
env_logger = "0.9.0"
libp2p = { path = "../..", default-features = false, features = ["identify", "relay", "ping", "noise", "plaintext", "tcp-async-io"] }
libp2p-identify = { path = "../identify" }
libp2p-kad = { path = "../kad" }
libp2p-ping = { path = "../ping" }
libp2p-plaintext = { path = "../../transports/plaintext" }
libp2p-yamux = { path = "../../muxers/yamux" }
libp2p = { path = "../..", default-features = false, features = ["identify", "kad", "ping", "plaintext", "tcp-async-io", "relay", "noise", "yamux"] }
quickcheck = "1"
clap = {version = "3.1.6", features = ["derive"]}

View File

@ -54,7 +54,7 @@ fn main() -> Result<(), Box<dyn Error>> {
noise::NoiseAuthenticated::xx(&local_key)
.expect("Signing libp2p-noise static DH keypair failed."),
)
.multiplex(libp2p_yamux::YamuxConfig::default())
.multiplex(libp2p::yamux::YamuxConfig::default())
.boxed();
let behaviour = Behaviour {

View File

@ -33,8 +33,8 @@ use libp2p::ping::{Ping, PingConfig, PingEvent};
use libp2p::plaintext::PlainText2Config;
use libp2p::relay::v2::client;
use libp2p::relay::v2::relay;
use libp2p::swarm::{AddressScore, NetworkBehaviour, Swarm, SwarmEvent};
use libp2p::NetworkBehaviour;
use libp2p_swarm::{AddressScore, NetworkBehaviour, Swarm, SwarmEvent};
use std::time::Duration;
#[test]
@ -343,7 +343,7 @@ where
transport
.upgrade(upgrade::Version::V1)
.authenticate(PlainText2Config { local_public_key })
.multiplex(libp2p_yamux::YamuxConfig::default())
.multiplex(libp2p::yamux::YamuxConfig::default())
.boxed()
}

View File

@ -24,9 +24,9 @@ pub mod harness;
use crate::harness::{await_event_or_timeout, await_events_or_timeout, new_swarm, SwarmExt};
use futures::stream::FuturesUnordered;
use futures::StreamExt;
use libp2p_core::identity;
use libp2p_rendezvous as rendezvous;
use libp2p_swarm::{DialError, Swarm, SwarmEvent};
use libp2p::core::identity;
use libp2p::rendezvous;
use libp2p::swarm::{DialError, Swarm, SwarmEvent};
use std::convert::TryInto;
use std::time::Duration;

View File

@ -25,7 +25,5 @@ unsigned-varint = { version = "0.7", features = ["std", "futures"] }
[dev-dependencies]
async-std = "1.6.2"
env_logger = "0.9.0"
libp2p-noise = { path = "../../transports/noise" }
libp2p-tcp = { path = "../../transports/tcp" }
libp2p-yamux = { path = "../../muxers/yamux" }
libp2p = { path = "../../", default-features = false, features = ["tcp-async-io", "noise", "yamux", "request-response"] }
rand = "0.7"

View File

@ -22,17 +22,17 @@
use async_trait::async_trait;
use futures::{channel::mpsc, prelude::*, AsyncWriteExt};
use libp2p_core::{
use libp2p::core::{
identity,
muxing::StreamMuxerBox,
transport::{self, Transport},
upgrade::{self, read_length_prefixed, write_length_prefixed},
Multiaddr, PeerId,
};
use libp2p_noise::NoiseAuthenticated;
use libp2p_request_response::*;
use libp2p_swarm::{Swarm, SwarmEvent};
use libp2p_tcp::{GenTcpConfig, TcpTransport};
use libp2p::noise::NoiseAuthenticated;
use libp2p::request_response::*;
use libp2p::swarm::{Swarm, SwarmEvent};
use libp2p::tcp::{GenTcpConfig, TcpTransport};
use rand::{self, Rng};
use std::{io, iter};
@ -301,7 +301,7 @@ fn mk_transport() -> (PeerId, transport::Boxed<(PeerId, StreamMuxerBox)>) {
TcpTransport::new(GenTcpConfig::default().nodelay(true))
.upgrade(upgrade::Version::V1)
.authenticate(NoiseAuthenticated::xx(&id_keys).unwrap())
.multiplex(libp2p_yamux::YamuxConfig::default())
.multiplex(libp2p::yamux::YamuxConfig::default())
.boxed(),
)
}

View File

@ -27,9 +27,6 @@ void = "1"
[dev-dependencies]
async-std = { version = "1.6.2", features = ["attributes"] }
env_logger = "0.9"
libp2p = { path = "../", default-features = false, features = ["identify", "ping", "plaintext", "yamux"] }
libp2p-mplex = { path = "../muxers/mplex" }
libp2p-noise = { path = "../transports/noise" }
libp2p-tcp = { path = "../transports/tcp" }
libp2p = { path = "../", default-features = false, features = ["plaintext", "identify", "ping", "noise", "yamux", "mplex", "tcp-async-io"] }
quickcheck = "0.9.0"
rand = "0.7.2"

View File

@ -17,6 +17,6 @@ flate2 = "1.0"
[dev-dependencies]
async-std = "1.6.2"
libp2p-tcp = { path = "../../transports/tcp" }
libp2p = { path = "../../", default-features = false, features = ["tcp-async-io", "deflate"] }
quickcheck = "0.9"
rand = "0.7"

View File

@ -19,9 +19,9 @@
// DEALINGS IN THE SOFTWARE.
use futures::{future, prelude::*};
use libp2p_core::{transport::Transport, upgrade};
use libp2p_deflate::DeflateConfig;
use libp2p_tcp::TcpTransport;
use libp2p::core::{transport::Transport, upgrade};
use libp2p::deflate::DeflateConfig;
use libp2p::tcp::TcpTransport;
use quickcheck::{QuickCheck, RngCore, TestResult};
#[test]

View File

@ -31,7 +31,7 @@ snow = { version = "0.9.0", features = ["default-resolver"], default-features =
[dev-dependencies]
async-io = "1.2.0"
env_logger = "0.9.0"
libp2p-tcp = { path = "../../transports/tcp" }
libp2p = { path = "../../", default-features = false, features = ["tcp-async-io", "noise"] }
quickcheck = "0.9.0"
libsodium-sys-stable = { version = "1.19.22", features = ["fetch-latest"] }
ed25519-compact = "1.0.11"

View File

@ -40,8 +40,8 @@
//!
//! ```
//! use libp2p_core::{identity, Transport, upgrade};
//! use libp2p_tcp::TcpTransport;
//! use libp2p_noise::{Keypair, X25519Spec, NoiseAuthenticated};
//! use libp2p::tcp::TcpTransport;
//! use libp2p::noise::{Keypair, X25519Spec, NoiseAuthenticated};
//!
//! # fn main() {
//! let id_keys = identity::Keypair::generate_ed25519();

View File

@ -23,14 +23,14 @@ use futures::{
future::{self, Either},
prelude::*,
};
use libp2p_core::identity;
use libp2p_core::transport::{self, Transport};
use libp2p_core::upgrade::{self, apply_inbound, apply_outbound, Negotiated};
use libp2p_noise::{
use libp2p::core::identity;
use libp2p::core::transport::{self, Transport};
use libp2p::core::upgrade::{self, apply_inbound, apply_outbound, Negotiated};
use libp2p::noise::{
Keypair, NoiseAuthenticated, NoiseConfig, NoiseError, NoiseOutput, RemoteIdentity, X25519Spec,
X25519,
};
use libp2p_tcp::TcpTransport;
use libp2p::tcp::TcpTransport;
use log::info;
use quickcheck::QuickCheck;
use std::{convert::TryInto, io, net::TcpStream};

View File

@ -24,4 +24,4 @@ url = "2.1"
webpki-roots = "0.22"
[dev-dependencies]
libp2p-tcp = { path = "../tcp" }
libp2p = { path = "../../", default-features = false, features = ["tcp-async-io"] }

View File

@ -219,8 +219,8 @@ where
mod tests {
use super::WsConfig;
use futures::prelude::*;
use libp2p_core::{multiaddr::Protocol, Multiaddr, PeerId, Transport};
use libp2p_tcp as tcp;
use libp2p::core::{multiaddr::Protocol, Multiaddr, PeerId, Transport};
use libp2p::tcp;
#[test]
fn dialer_connects_to_listener_ipv4() {