#tls-stream #tls-api #tokio #non-blocking #async-io #native-tls #connect

tokio-tls-api

An implementation of TLS/SSL streams for Tokio giving an implementation of TLS for nonblocking I/O streams

19 releases

Uses old Rust 2015

0.2.1 Jan 1, 2020
0.2.0 May 26, 2019
0.1.22 Apr 28, 2019
0.1.20 Jul 15, 2018
0.1.8 Jun 17, 2017

#2133 in Asynchronous

Download history 2949/week @ 2024-03-14 2794/week @ 2024-03-21 4079/week @ 2024-03-28 2618/week @ 2024-04-04 1957/week @ 2024-04-11 2595/week @ 2024-04-18 6298/week @ 2024-04-25 6220/week @ 2024-05-02 6639/week @ 2024-05-09 6169/week @ 2024-05-16 5824/week @ 2024-05-23 6539/week @ 2024-05-30 6874/week @ 2024-06-06 6348/week @ 2024-06-13 6209/week @ 2024-06-20 3990/week @ 2024-06-27

24,745 downloads per month
Used in 12 crates (via lapin-futures-tls-api)

MIT/Apache

97KB
2K SLoC

tokio-tls

An implementation of TLS/SSL streams for Tokio built on top of the native-tls crate

Build Status Build status

Documentation

Usage

First, add this to your Cargo.toml:

[dependencies]
native-tls = "0.1"
tokio-tls = "0.1"

Next, add this to your crate:

extern crate tls_api;
extern crate tokio_tls_api;

use tokio_tls::{TlsConnectorExt, TlsAcceptorExt};

You can find an example of using this crate at https://tokio.rs along with a detailed explanation of what's happening.

This crate provides two extension traits, TlsConnectorExt and TlsAcceptorExt, which augment the functionality provided by the native-tls crate. These extension traits provide the ability to connect a stream asynchronously and accept a socket asynchronously. Configuration of TLS parameters is still done through the support in the native-tls crate.

By default the native-tls crate currently uses the "platform appropriate" backend for a TLS implementation. This means:

Typically these selections mean that you don't have to worry about a portability when using TLS, these libraries are all normally installed by default.

Interaction with tokio-proto

If you're working with a protocol that starts out with a TLS negotation on either the client or server side then you can use the proto::Client and proto::Server types in this crate for performing those tasks. To do so, you can update your dependency as such:

[dependencies]
tokio-tls = { version = "0.1", features = ["tokio-proto"] }

License

tokio-tls is primarily distributed under the terms of both the MIT license and the Apache License (Version 2.0), with portions covered by various BSD-like licenses.

See LICENSE-APACHE, and LICENSE-MIT for details.

Dependencies

~0.5–1.8MB
~27K SLoC