Skip to content

Commit

Permalink
explain libp2p changes
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 ff1045d commit 24a36ab
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions mm2src/mm2_libp2p/src/atomicdex_behaviour.rs
Original file line number Diff line number Diff line change
Expand Up @@ -828,13 +828,13 @@ fn build_dns_ws_transport(
) -> BoxedTransport<(PeerId, libp2p::core::muxing::StreamMuxerBox)> {
use libp2p::websocket::tls as libp2p_tls;

let dns_tcp = libp2p::dns::TokioDnsConfig::custom(
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(dns_tcp);
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 @@ -846,12 +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 24a36ab

Please sign in to comment.