Skip to content

Commit

Permalink
[websocket] Switch async-tls to futures-rustls (#1889)
Browse files Browse the repository at this point in the history
* [websocket] Switch async-tls to async-rustls

* Switch to futures-rustls

Co-authored-by: Roman Borschel <romanb@users.noreply.github.com>
  • Loading branch information
quininer and romanb authored Jan 12, 2021
1 parent 477f7ae commit a223e4b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
4 changes: 1 addition & 3 deletions transports/websocket/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,15 @@ keywords = ["peer-to-peer", "libp2p", "networking"]
categories = ["network-programming", "asynchronous"]

[dependencies]
async-tls = "0.11.0"
futures-rustls = "0.21"
either = "1.5.3"
futures = "0.3.1"
libp2p-core = { version = "0.27.0", path = "../../core" }
log = "0.4.8"
quicksink = "0.1"
rustls = "0.19.0"
rw-stream-sink = "0.2.0"
soketto = { version = "0.4.1", features = ["deflate"] }
url = "2.1"
webpki = "0.21"
webpki-roots = "0.21"

[dev-dependencies]
Expand Down
4 changes: 2 additions & 2 deletions transports/websocket/src/framed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.

use async_tls::{client, server};
use futures_rustls::{webpki, client, server};
use crate::{error::Error, tls};
use either::Either;
use futures::{future::BoxFuture, prelude::*, ready, stream::BoxStream};
Expand Down Expand Up @@ -310,7 +310,7 @@ where
if use_tls { // begin TLS session
let dns_name = dns_name.expect("for use_tls we have checked that dns_name is some");
trace!("starting TLS handshake with {}", address);
let stream = self.tls_config.client.connect(&dns_name, stream)
let stream = self.tls_config.client.connect(dns_name.as_ref(), stream)
.map_err(|e| {
debug!("TLS handshake with {} failed: {}", address, e);
Error::Tls(tls::Error::from(e))
Expand Down
2 changes: 1 addition & 1 deletion transports/websocket/src/tls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.

use async_tls::{TlsConnector, TlsAcceptor};
use futures_rustls::{rustls, webpki, TlsConnector, TlsAcceptor};
use std::{fmt, io, sync::Arc};

/// TLS configuration.
Expand Down

0 comments on commit a223e4b

Please sign in to comment.