Update docs for rustls mentions

pull/166/head
Dominik Nakamura 4 years ago
parent 5a3dd8acfd
commit be05920e08
No known key found for this signature in database
GPG Key ID: E4C6A749B2491910
  1. 3
      README.md
  2. 20
      src/client.rs
  3. 12
      src/server.rs
  4. 2
      tests/connection_reset.rs

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

@ -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<AutoStream> {
@ -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<Req: IntoClientRequest>(
request: Req,
config: Option<WebSocketConfig>,
@ -184,15 +184,15 @@ pub fn connect_with_config<Req: IntoClientRequest>(
/// 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<Req: IntoClientRequest>(request: Req) -> Result<(WebSocket<AutoStream>, Response)> {
connect_with_config(request, None, 3)
}
@ -213,7 +213,7 @@ fn connect_to_some(addrs: &[SocketAddr], uri: &Uri, mode: Mode) -> Result<AutoSt
/// Get the mode of the given URL.
///
/// This function may be used to ease the creation of custom TLS streams
/// in non-blocking algorithmss or for use with TLS libraries other than `native_tls`.
/// in non-blocking algorithms or for use with TLS libraries other than `native_tls` or `rustls`.
pub fn uri_mode(uri: &Uri) -> Result<Mode> {
match uri.scheme_str() {
Some("ws") => Ok(Mode::Plain),

@ -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<S: Read + Write>(
stream: S,
config: Option<WebSocketConfig>,
@ -30,9 +30,9 @@ pub fn accept_with_config<S: Read + Write>(
/// 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<S: Read + Write>(
stream: S,
) -> Result<WebSocket<S>, HandshakeError<ServerHandshake<S, NoCallback>>> {

@ -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::{

Loading…
Cancel
Save