mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2024-12-24 23:19:34 -05:00
Bump to libp2p v29
This commit is contained in:
parent
ad006fae6a
commit
2059158dad
@ -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" }
|
bitcoin-harness = { git = "https://github.com/coblox/bitcoin-harness-rs", rev = "d402b36d3d6406150e3bfb71492ff4a0a7cb290e" }
|
||||||
derivative = "2"
|
derivative = "2"
|
||||||
futures = { version = "0.3", default-features = false }
|
futures = { version = "0.3", default-features = false }
|
||||||
libp2p = { version = "0.28", default-features = false, features = ["tcp-tokio", "yamux", "mplex", "dns", "noise", "request-response"] }
|
libp2p = { version = "0.29", default-features = false, features = ["tcp-tokio", "yamux", "mplex", "dns", "noise", "request-response"] }
|
||||||
libp2p-tokio-socks5 = "0.3"
|
libp2p-tokio-socks5 = "0.4"
|
||||||
log = { version = "0.4", features = ["serde"] }
|
log = { version = "0.4", features = ["serde"] }
|
||||||
monero = "0.9"
|
monero = "0.9"
|
||||||
rand = "0.7"
|
rand = "0.7"
|
||||||
|
@ -1,20 +1,18 @@
|
|||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use libp2p::{
|
use libp2p::{
|
||||||
core::{
|
core::{
|
||||||
either::EitherError,
|
|
||||||
identity,
|
identity,
|
||||||
muxing::StreamMuxerBox,
|
muxing::StreamMuxerBox,
|
||||||
transport::{boxed::Boxed, timeout::TransportTimeoutError},
|
transport::Boxed,
|
||||||
upgrade::{SelectUpgrade, Version},
|
upgrade::{SelectUpgrade, Version},
|
||||||
Transport, UpgradeError,
|
Transport,
|
||||||
},
|
},
|
||||||
dns::{DnsConfig, DnsErr},
|
dns::DnsConfig,
|
||||||
mplex::MplexConfig,
|
mplex::MplexConfig,
|
||||||
noise::{self, NoiseConfig, NoiseError, X25519Spec},
|
noise::{self, NoiseConfig, X25519Spec},
|
||||||
tcp::TokioTcpConfig,
|
tcp::TokioTcpConfig,
|
||||||
yamux, PeerId,
|
yamux, PeerId,
|
||||||
};
|
};
|
||||||
use std::{io, time::Duration};
|
|
||||||
|
|
||||||
/// Builds a libp2p transport with the following features:
|
/// Builds a libp2p transport with the following features:
|
||||||
/// - TcpConnection
|
/// - TcpConnection
|
||||||
@ -36,18 +34,9 @@ pub fn build(id_keys: identity::Keypair) -> Result<SwapTransport> {
|
|||||||
MplexConfig::new(),
|
MplexConfig::new(),
|
||||||
))
|
))
|
||||||
.map(|(peer, muxer), _| (peer, StreamMuxerBox::new(muxer)))
|
.map(|(peer, muxer), _| (peer, StreamMuxerBox::new(muxer)))
|
||||||
.timeout(Duration::from_secs(20))
|
|
||||||
.boxed();
|
.boxed();
|
||||||
|
|
||||||
Ok(transport)
|
Ok(transport)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type SwapTransport = Boxed<
|
pub type SwapTransport = Boxed<(PeerId, StreamMuxerBox)>;
|
||||||
(PeerId, StreamMuxerBox),
|
|
||||||
TransportTimeoutError<
|
|
||||||
EitherError<
|
|
||||||
EitherError<DnsErr<io::Error>, UpgradeError<NoiseError>>,
|
|
||||||
UpgradeError<EitherError<io::Error, io::Error>>,
|
|
||||||
>,
|
|
||||||
>,
|
|
||||||
>;
|
|
||||||
|
Loading…
Reference in New Issue
Block a user