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
@@ -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)