Put back support for WebSockets in the transport (#1486)

This commit is contained in:
Pierre Krieger
2019-01-19 12:41:17 +01:00
committed by Gav Wood
parent b009b42a68
commit 763d133173
3 changed files with 254 additions and 2 deletions
+1 -1
View File
@@ -12,7 +12,7 @@ bytes = "0.4"
error-chain = { version = "0.12", default-features = false }
fnv = "1.0"
futures = "0.1"
libp2p = { version = "0.2", default-features = false, features = ["secio-rsa", "secio-secp256k1"] }
libp2p = { version = "0.2", default-features = false, features = ["secio-rsa", "secio-secp256k1", "libp2p-websocket"] }
parking_lot = "0.7.1"
log = "0.4"
rand = "0.5.0"
@@ -15,7 +15,7 @@
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
use futures::prelude::*;
use libp2p::{InboundUpgradeExt, OutboundUpgradeExt, PeerId, Transport, mplex, secio, yamux, tcp, dns};
use libp2p::{InboundUpgradeExt, OutboundUpgradeExt, PeerId, Transport, mplex, secio, yamux, tcp, dns, websocket};
use libp2p::core::{self, transport::boxed::Boxed, muxing::StreamMuxerBox};
use std::{io, time::Duration, usize};
@@ -28,6 +28,7 @@ pub fn build_transport(
mplex_config.max_buffer_len(usize::MAX);
let transport = tcp::TcpConfig::new();
let transport = websocket::WsConfig::new(transport.clone()).or_transport(transport);
let transport = dns::DnsConfig::new(transport);
// TODO: rework the transport creation (https://github.com/libp2p/rust-libp2p/issues/783)