diff --git a/README.md b/README.md index 7173582..1a85643 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,8 @@ Features -------- Tungstenite provides a complete implementation of the WebSocket specification. -TLS is supported on all platforms using native-tls. +TLS is supported on all platforms using native-tls or rustls available through the `use-native-tls` +and `use-rustls` feature flags. There is no support for permessage-deflate at the moment. It's planned. diff --git a/src/client.rs b/src/client.rs index 1dd3286..0b20201 100644 --- a/src/client.rs +++ b/src/client.rs @@ -89,7 +89,7 @@ mod encryption { stream::Mode, }; - /// TLS support is nod compiled in, this is just standard `TcpStream`. + /// TLS support is not compiled in, this is just standard `TcpStream`. pub type AutoStream = TcpStream; pub fn wrap_stream(stream: TcpStream, _domain: &str, mode: Mode) -> Result { @@ -116,15 +116,15 @@ use crate::{ /// equal to calling `connect()` function. /// /// The URL may be either ws:// or wss://. -/// To support wss:// URLs, feature "tls" must be turned on. +/// To support wss:// URLs, feature `use-native-tls` or `use-rustls` must be turned on. /// /// This function "just works" for those who wants a simple blocking solution /// similar to `std::net::TcpStream`. If you want a non-blocking or other /// custom stream, call `client` instead. /// -/// This function uses `native_tls` to do TLS. If you want to use other TLS libraries, -/// use `client` instead. There is no need to enable the "tls" feature if you don't call -/// `connect` since it's the only function that uses native_tls. +/// This function uses `native_tls` or `rustls` to do TLS depending on the feature flags enabled. If +/// you want to use other TLS libraries, use `client` instead. There is no need to enable the "tls" +/// feature if you don't call `connect` since it's the only function that uses native_tls or rustls. pub fn connect_with_config( request: Req, config: Option, @@ -184,15 +184,15 @@ pub fn connect_with_config( /// Connect to the given WebSocket in blocking mode. /// /// The URL may be either ws:// or wss://. -/// To support wss:// URLs, feature "tls" must be turned on. +/// To support wss:// URLs, feature `use-native-tls` or `use-rustls` must be turned on. /// /// This function "just works" for those who wants a simple blocking solution /// similar to `std::net::TcpStream`. If you want a non-blocking or other /// custom stream, call `client` instead. /// -/// This function uses `native_tls` to do TLS. If you want to use other TLS libraries, -/// use `client` instead. There is no need to enable the "tls" feature if you don't call -/// `connect` since it's the only function that uses native_tls. +/// This function uses `native_tls` or `rustls` to do TLS depending on the feature flags enabled. If +/// you want to use other TLS libraries, use `client` instead. There is no need to enable the "tls" +/// feature if you don't call `connect` since it's the only function that uses native_tls or rustls. pub fn connect(request: Req) -> Result<(WebSocket, Response)> { connect_with_config(request, None, 3) } @@ -213,7 +213,7 @@ fn connect_to_some(addrs: &[SocketAddr], uri: &Uri, mode: Mode) -> Result Result { match uri.scheme_str() { Some("ws") => Ok(Mode::Plain), diff --git a/src/server.rs b/src/server.rs index 53303ee..e79bccb 100644 --- a/src/server.rs +++ b/src/server.rs @@ -17,9 +17,9 @@ use std::io::{Read, Write}; /// used by `accept()`. /// /// This function starts a server WebSocket handshake over the given stream. -/// If you want TLS support, use `native_tls::TlsStream` or `openssl::ssl::SslStream` -/// for the stream here. Any `Read + Write` streams are supported, including -/// those from `Mio` and others. +/// If you want TLS support, use `native_tls::TlsStream`, `rustls::Stream` or +/// `openssl::ssl::SslStream` for the stream here. Any `Read + Write` streams are supported, +/// including those from `Mio` and others. pub fn accept_with_config( stream: S, config: Option, @@ -30,9 +30,9 @@ pub fn accept_with_config( /// Accept the given Stream as a WebSocket. /// /// This function starts a server WebSocket handshake over the given stream. -/// If you want TLS support, use `native_tls::TlsStream` or `openssl::ssl::SslStream` -/// for the stream here. Any `Read + Write` streams are supported, including -/// those from `Mio` and others. +/// If you want TLS support, use `native_tls::TlsStream`, `rustls::Stream` or +/// `openssl::ssl::SslStream` for the stream here. Any `Read + Write` streams are supported, +/// including those from `Mio` and others. pub fn accept( stream: S, ) -> Result, HandshakeError>> { diff --git a/tests/connection_reset.rs b/tests/connection_reset.rs index 3bcd65f..b83bcb9 100644 --- a/tests/connection_reset.rs +++ b/tests/connection_reset.rs @@ -1,5 +1,5 @@ //! Verifies that the server returns a `ConnectionClosed` error when the connection -//! is closedd from the server's point of view and drop the underlying tcp socket. +//! is closed from the server's point of view and drop the underlying tcp socket. #![cfg(any(feature = "use-native-tls", feature = "use-rustls"))] use std::{