Skip to content

Commit

Permalink
upgrade libp2p to 0.45.1
Browse files Browse the repository at this point in the history
Signed-off-by: ozkanonur <work@onurozkan.dev>
  • Loading branch information
onur-ozkan committed Feb 20, 2023
1 parent 7ad3819 commit 5f83b09
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 32 deletions.
40 changes: 20 additions & 20 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions mm2src/floodsub/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ doctest = false
[dependencies]
cuckoofilter = "0.3.2"
futures = "0.3.1"
libp2p-core = { git = "https://github.com/libp2p/rust-libp2p.git" }
libp2p-swarm = { git = "https://github.com/libp2p/rust-libp2p.git" }
libp2p-core = { git = "https://github.com/libp2p/rust-libp2p.git", tag ="v0.45.1" }
libp2p-swarm = { git = "https://github.com/libp2p/rust-libp2p.git", tag ="v0.45.1" }
prost = "0.10"
rand = "0.7"
smallvec = "1.0"
Expand Down
8 changes: 4 additions & 4 deletions mm2src/gossipsub/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ common = { path = "../common" }
fnv = "1.0.6"
futures = "0.3.1"
futures_codec = "0.4.0"
libp2p-swarm = { git = "https://github.com/libp2p/rust-libp2p.git" }
libp2p-core = { git = "https://github.com/libp2p/rust-libp2p.git" }
libp2p-swarm = { git = "https://github.com/libp2p/rust-libp2p.git", tag ="v0.45.1" }
libp2p-core = { git = "https://github.com/libp2p/rust-libp2p.git", tag ="v0.45.1" }
log = "0.4.8"
prost = "0.10"
rand = "0.7"
Expand All @@ -33,8 +33,8 @@ wasm-timer = "0.2.4"
[dev-dependencies]
async-std = "1.6.2"
env_logger = "0.7.1"
libp2p-plaintext = { git = "https://github.com/libp2p/rust-libp2p.git" }
libp2p-yamux = { git = "https://github.com/libp2p/rust-libp2p.git" }
libp2p-plaintext = { git = "https://github.com/libp2p/rust-libp2p.git", tag ="v0.45.1" }
libp2p-yamux = { git = "https://github.com/libp2p/rust-libp2p.git", tag ="v0.45.1" }
quickcheck = "0.9.2"

[build-dependencies]
Expand Down
4 changes: 2 additions & 2 deletions mm2src/mm2_libp2p/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ wasm-timer = "0.2.4"

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
tokio = { version = "1.20", features = ["rt-multi-thread", "macros"] }
libp2p = { git = "https://github.com/libp2p/rust-libp2p.git", default-features = false, features = ["dns-tokio", "floodsub", "mplex", "noise", "ping", "request-response", "secp256k1", "tcp-tokio", "websocket"] }
libp2p = { git = "https://github.com/libp2p/rust-libp2p.git", tag = "v0.45.1", default-features = false, features = ["dns-tokio", "floodsub", "mplex", "noise", "ping", "request-response", "secp256k1", "tcp-tokio", "websocket"] }

[target.'cfg(target_arch = "wasm32")'.dependencies]
getrandom = { version = "0.2", features = ["js"] } # see https://docs.rs/getrandom/0.2.0/getrandom/#webassembly-support
libp2p = { git = "https://github.com/libp2p/rust-libp2p.git", default-features = false, features = ["floodsub", "mplex", "noise", "ping", "request-response", "secp256k1", "wasm-ext", "wasm-ext-websocket"] }
libp2p = { git = "https://github.com/libp2p/rust-libp2p.git", tag = "v0.45.1", default-features = false, features = ["floodsub", "mplex", "noise", "ping", "request-response", "secp256k1", "wasm-ext", "wasm-ext-websocket"] }
wasm-bindgen-futures = "0.4.21"

[dev-dependencies]
Expand Down
20 changes: 16 additions & 4 deletions mm2src/mm2_libp2p/src/atomicdex_behaviour.rs
Original file line number Diff line number Diff line change
Expand Up @@ -828,10 +828,13 @@ fn build_dns_ws_transport(
) -> BoxedTransport<(PeerId, libp2p::core::muxing::StreamMuxerBox)> {
use libp2p::websocket::tls as libp2p_tls;

let tcp = libp2p::tcp::TokioTcpConfig::new().nodelay(true);
let dns_tcp =
libp2p::dns::TokioDnsConfig::custom(tcp, libp2p::dns::ResolverConfig::google(), Default::default()).unwrap();
let mut ws_dns_tcp = libp2p::websocket::WsConfig::new(dns_tcp.clone());
let ws_tcp = libp2p::dns::TokioDnsConfig::custom(
libp2p::tcp::TokioTcpConfig::new().nodelay(true),
libp2p::dns::ResolverConfig::google(),
Default::default(),
)
.unwrap();
let mut ws_dns_tcp = libp2p::websocket::WsConfig::new(ws_tcp);

if let Some(certs) = wss_certs {
let server_priv_key = libp2p_tls::PrivateKey::new(certs.server_priv_key.0.clone());
Expand All @@ -843,6 +846,15 @@ fn build_dns_ws_transport(
ws_dns_tcp.set_tls_config(wss_config);
}

// This is for preventing port reuse of dns/tcp instead of
// websocket ports.
let dns_tcp = libp2p::dns::TokioDnsConfig::custom(
libp2p::tcp::TokioTcpConfig::new().nodelay(true),
libp2p::dns::ResolverConfig::google(),
Default::default(),
)
.unwrap();

let transport = dns_tcp.or_transport(ws_dns_tcp);
upgrade_transport(transport, noise_keys)
}
Expand Down

0 comments on commit 5f83b09

Please sign in to comment.