Bump to libp2p v29

This commit is contained in:
Tobin C. Harding 2020-10-22 13:39:18 +11:00
parent ad006fae6a
commit 2059158dad
2 changed files with 7 additions and 18 deletions

View File

@ -15,8 +15,8 @@ bitcoin = { version = "0.23", features = ["rand", "use-serde"] } # TODO: Upgrade
bitcoin-harness = { git = "https://github.com/coblox/bitcoin-harness-rs", rev = "d402b36d3d6406150e3bfb71492ff4a0a7cb290e" }
derivative = "2"
futures = { version = "0.3", default-features = false }
libp2p = { version = "0.28", default-features = false, features = ["tcp-tokio", "yamux", "mplex", "dns", "noise", "request-response"] }
libp2p-tokio-socks5 = "0.3"
libp2p = { version = "0.29", default-features = false, features = ["tcp-tokio", "yamux", "mplex", "dns", "noise", "request-response"] }
libp2p-tokio-socks5 = "0.4"
log = { version = "0.4", features = ["serde"] }
monero = "0.9"
rand = "0.7"

View File

@ -1,20 +1,18 @@
use anyhow::Result;
use libp2p::{
core::{
either::EitherError,
identity,
muxing::StreamMuxerBox,
transport::{boxed::Boxed, timeout::TransportTimeoutError},
transport::Boxed,
upgrade::{SelectUpgrade, Version},
Transport, UpgradeError,
Transport,
},
dns::{DnsConfig, DnsErr},
dns::DnsConfig,
mplex::MplexConfig,
noise::{self, NoiseConfig, NoiseError, X25519Spec},
noise::{self, NoiseConfig, X25519Spec},
tcp::TokioTcpConfig,
yamux, PeerId,
};
use std::{io, time::Duration};
/// Builds a libp2p transport with the following features:
/// - TcpConnection
@ -36,18 +34,9 @@ pub fn build(id_keys: identity::Keypair) -> Result<SwapTransport> {
MplexConfig::new(),
))
.map(|(peer, muxer), _| (peer, StreamMuxerBox::new(muxer)))
.timeout(Duration::from_secs(20))
.boxed();
Ok(transport)
}
pub type SwapTransport = Boxed<
(PeerId, StreamMuxerBox),
TransportTimeoutError<
EitherError<
EitherError<DnsErr<io::Error>, UpgradeError<NoiseError>>,
UpgradeError<EitherError<io::Error, io::Error>>,
>,
>,
>;
pub type SwapTransport = Boxed<(PeerId, StreamMuxerBox)>;