boring2/tokio-boring
Anthony Ramine f5f47dd5a7 Remove feature rpk from hyper-boring and tokio-boring
Feature rpk in boring doesn't do anything unless you
explicitly use `SslAcceptor::rpk` or `SslContext::rpk_builder`,
and neither of these types are directly reachable if the
user depends only on tokio-boring or hyper-boring, which
means you still need to explicitly depend on the boring crate
to use RPK, in which case you can enable the feature there.
2023-10-23 15:06:23 +02:00
..
examples Update documentation for tokio-boring 2021-07-29 11:28:43 -04:00
src Remove futures from ex data slots once they resolve 2023-10-10 09:22:36 +01:00
tests Introduce async callbacks 2023-10-10 09:22:36 +01:00
CHANGELOG.md Add/update changelogs 2021-12-16 13:52:38 -06:00
Cargo.toml Remove feature rpk from hyper-boring and tokio-boring 2023-10-23 15:06:23 +02:00
LICENSE-APACHE Add tokio-boring 2020-11-11 19:26:22 +00:00
LICENSE-MIT Add hyper-boring 2020-11-11 20:29:54 +00:00
README.md Update documentation for tokio-boring 2021-07-29 11:28:43 -04:00

README.md

tokio-boring

An implementation of SSL streams for Tokio built on top of the BoringSSL.

Documentation

Usage

First, add this to your Cargo.toml:

[dependencies]
tokio-boring = "1.0.0"

Then, use either accept or connect as appropriate.

use boring::ssl;
use tokio::net::TcpListener;

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let listener = TcpListener::bind("127.0.0.1:8080").await?;
    let (tcp_stream, _addr) = listener.accept().await?;

    let server = ssl::SslMethod::tls_server();
    let mut ssl_builder = boring::ssl::SslAcceptor::mozilla_modern(server)?;
    ssl_builder.set_default_verify_paths()?;
    ssl_builder.set_verify(ssl::SslVerifyMode::PEER);
    let acceptor = ssl_builder.build();
    let _ssl_stream = tokio_boring::accept(&acceptor, tcp_stream).await?;
    Ok(())
}

This library is an implementation of TLS streams using BoringSSL for negotiating the connection. Each TLS stream implements the Read and Write traits to interact and interoperate with the rest of the futures I/O ecosystem. Client connections initiated from this crate verify hostnames automatically and by default.

tokio-boring exports this ability through [accept] and [connect]. accept should be used by servers, and connect by clients. These augment the functionality provided by the [boring] crate, on which this crate is built. Configuration of TLS parameters is still primarily done through the [boring] crate.

License

This project is licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in Serde by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Accolades

The project is based on a fork of tokio-openssl.