Move tokio-rustls to top level
This commit is contained in:
parent
0ce49fa9cd
commit
b496e24270
38
Cargo.toml
38
Cargo.toml
@ -1,4 +1,34 @@
|
|||||||
[workspace]
|
[package]
|
||||||
members = [
|
name = "tokio-rustls"
|
||||||
"tokio-rustls",
|
version = "0.24.0"
|
||||||
]
|
authors = ["quininer kel <quininer@live.com>"]
|
||||||
|
license = "MIT/Apache-2.0"
|
||||||
|
repository = "https://github.com/tokio-rs/tls"
|
||||||
|
homepage = "https://github.com/tokio-rs/tls"
|
||||||
|
documentation = "https://docs.rs/tokio-rustls"
|
||||||
|
readme = "README.md"
|
||||||
|
description = "Asynchronous TLS/SSL streams for Tokio using Rustls."
|
||||||
|
categories = ["asynchronous", "cryptography", "network-programming"]
|
||||||
|
edition = "2018"
|
||||||
|
rust-version = "1.56"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
tokio = "1.0"
|
||||||
|
rustls = { version = "0.21.0", default-features = false }
|
||||||
|
|
||||||
|
[features]
|
||||||
|
default = ["logging", "tls12"]
|
||||||
|
dangerous_configuration = ["rustls/dangerous_configuration"]
|
||||||
|
early-data = []
|
||||||
|
logging = ["rustls/logging"]
|
||||||
|
secret_extraction = ["rustls/secret_extraction"]
|
||||||
|
tls12 = ["rustls/tls12"]
|
||||||
|
|
||||||
|
[dev-dependencies]
|
||||||
|
argh = "0.1"
|
||||||
|
tokio = { version = "1.0", features = ["full"] }
|
||||||
|
futures-util = "0.3.1"
|
||||||
|
lazy_static = "1"
|
||||||
|
webpki-roots = "0.22"
|
||||||
|
rustls-pemfile = "1"
|
||||||
|
webpki = { package = "rustls-webpki", version = "0.100.0", features = ["alloc", "std"] }
|
||||||
|
25
LICENSE
25
LICENSE
@ -1,25 +0,0 @@
|
|||||||
Copyright (c) 2019 Tokio Contributors
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any
|
|
||||||
person obtaining a copy of this software and associated
|
|
||||||
documentation files (the "Software"), to deal in the
|
|
||||||
Software without restriction, including without
|
|
||||||
limitation the rights to use, copy, modify, merge,
|
|
||||||
publish, distribute, sublicense, and/or sell copies of
|
|
||||||
the Software, and to permit persons to whom the Software
|
|
||||||
is furnished to do so, subject to the following
|
|
||||||
conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice
|
|
||||||
shall be included in all copies or substantial portions
|
|
||||||
of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
|
|
||||||
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
|
||||||
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
|
||||||
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
|
|
||||||
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
||||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
||||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
|
||||||
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
DEALINGS IN THE SOFTWARE.
|
|
99
README.md
99
README.md
@ -1,66 +1,77 @@
|
|||||||
# Tokio Tls
|
# tokio-rustls
|
||||||
|
[![github actions](https://github.com/tokio-rs/tls/workflows/CI/badge.svg)](https://github.com/tokio-rs/tls/actions)
|
||||||
|
[![crates](https://img.shields.io/crates/v/tokio-rustls.svg)](https://crates.io/crates/tokio-rustls)
|
||||||
|
[![license](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/tokio-rs/tls/blob/master/tokio-rustls/LICENSE-MIT)
|
||||||
|
[![license](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/tokio-rs/tls/blob/master/tokio-rustls/LICENSE-APACHE)
|
||||||
|
[![docs.rs](https://docs.rs/tokio-rustls/badge.svg)](https://docs.rs/tokio-rustls)
|
||||||
|
|
||||||
## Overview
|
Asynchronous TLS/SSL streams for [Tokio](https://tokio.rs/) using
|
||||||
|
[Rustls](https://github.com/rustls/rustls).
|
||||||
|
|
||||||
This crate contains a collection of Tokio based TLS libraries.
|
### Basic Structure of a Client
|
||||||
|
|
||||||
- [`tokio-native-tls`](tokio-native-tls)
|
```rust
|
||||||
- [`tokio-rustls`](tokio-rustls)
|
use std::sync::Arc;
|
||||||
|
use tokio::net::TcpStream;
|
||||||
|
use tokio_rustls::rustls::{ClientConfig, OwnedTrustAnchor, RootCertStore, ServerName};
|
||||||
|
use tokio_rustls::TlsConnector;
|
||||||
|
|
||||||
## Getting Help
|
// ...
|
||||||
|
|
||||||
First, see if the answer to your question can be found in the [Tutorials] or the
|
let mut root_cert_store = RootCertStore::empty();
|
||||||
[API documentation]. If the answer is not there, there is an active community in
|
root_cert_store.add_server_trust_anchors(webpki_roots::TLS_SERVER_ROOTS.0.iter().map(|ta| {
|
||||||
the [Tokio Discord server][chat]. We would be happy to try to answer your
|
OwnedTrustAnchor::from_subject_spki_name_constraints(
|
||||||
question. Last, if that doesn't work, try opening an [issue] with the question.
|
ta.subject,
|
||||||
|
ta.spki,
|
||||||
|
ta.name_constraints,
|
||||||
|
)
|
||||||
|
}));
|
||||||
|
let config = ClientConfig::builder()
|
||||||
|
.with_safe_defaults()
|
||||||
|
.with_root_certificates(root_cert_store)
|
||||||
|
.with_no_client_auth();
|
||||||
|
let connector = TlsConnector::from(Arc::new(config));
|
||||||
|
let dnsname = ServerName::try_from("www.rust-lang.org").unwrap();
|
||||||
|
|
||||||
[Tutorials]: https://tokio.rs/tokio/tutorial
|
let stream = TcpStream::connect(&addr).await?;
|
||||||
[API documentation]: https://docs.rs/tokio/latest/tokio
|
let mut stream = connector.connect(dnsname, stream).await?;
|
||||||
[chat]: https://discord.gg/tokio
|
|
||||||
[issue]: https://github.com/tokio-rs/tls/issues/new
|
|
||||||
|
|
||||||
## Contributing
|
// ...
|
||||||
|
```
|
||||||
|
|
||||||
:balloon: Thanks for your help improving the project! We are so happy to have
|
### Client Example Program
|
||||||
you! We have a [contributing guide][guide] to help you get involved in the Tokio
|
|
||||||
project.
|
|
||||||
|
|
||||||
[guide]: CONTRIBUTING.md
|
See [examples/client](examples/client/src/main.rs). You can run it with:
|
||||||
|
|
||||||
## Related Projects
|
```sh
|
||||||
|
cd examples/client
|
||||||
|
cargo run -- hsts.badssl.com
|
||||||
|
```
|
||||||
|
|
||||||
In addition to the crates in this repository, the Tokio project also maintains
|
### Server Example Program
|
||||||
several other libraries, including:
|
|
||||||
|
|
||||||
* [`tokio`]: A runtime for writing reliable, asynchronous, and slim applications with the Rust programming language.
|
See [examples/server](examples/server/src/main.rs). You can run it with:
|
||||||
|
|
||||||
* [`tracing`] (formerly `tokio-trace`): A framework for application-level
|
```sh
|
||||||
tracing and async-aware diagnostics.
|
cd examples/server
|
||||||
|
cargo run -- 127.0.0.1:8000 --cert mycert.der --key mykey.der
|
||||||
|
```
|
||||||
|
|
||||||
* [`mio`]: A low-level, cross-platform abstraction over OS I/O APIs that powers
|
### License & Origin
|
||||||
`tokio`.
|
|
||||||
|
|
||||||
* [`bytes`]: Utilities for working with bytes, including efficient byte buffers.
|
This project is licensed under either of
|
||||||
|
|
||||||
[`tokio`]: https://github.com/tokio-rs/tokio
|
* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
||||||
[`tracing`]: https://github.com/tokio-rs/tracing
|
https://www.apache.org/licenses/LICENSE-2.0)
|
||||||
[`mio`]: https://github.com/tokio-rs/mio
|
* MIT license ([LICENSE-MIT](LICENSE-MIT) or
|
||||||
[`bytes`]: https://github.com/tokio-rs/bytes
|
https://opensource.org/licenses/MIT)
|
||||||
|
|
||||||
## Supported Rust Versions
|
at your option.
|
||||||
|
|
||||||
Tokio is built against the latest stable, nightly, and beta Rust releases. The
|
This started as a fork of [tokio-tls](https://github.com/tokio-rs/tokio-tls).
|
||||||
minimum version supported is the stable release from three months before the
|
|
||||||
current stable release version. For example, if the latest stable Rust is 1.29,
|
|
||||||
the minimum version supported is 1.26. The current Tokio version is not
|
|
||||||
guaranteed to build on Rust versions earlier than the minimum supported version.
|
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
This project is licensed under the [MIT license](LICENSE).
|
|
||||||
|
|
||||||
### Contribution
|
### Contribution
|
||||||
|
|
||||||
Unless you explicitly state otherwise, any contribution intentionally submitted
|
Unless you explicitly state otherwise, any contribution intentionally submitted
|
||||||
for inclusion in Tokio by you, shall be licensed as MIT, without any additional
|
for inclusion in tokio-rustls by you, as defined in the Apache-2.0 license, shall be
|
||||||
terms or conditions.
|
dual licensed as above, without any additional terms or conditions.
|
||||||
|
@ -1,34 +0,0 @@
|
|||||||
[package]
|
|
||||||
name = "tokio-rustls"
|
|
||||||
version = "0.24.0"
|
|
||||||
authors = ["quininer kel <quininer@live.com>"]
|
|
||||||
license = "MIT/Apache-2.0"
|
|
||||||
repository = "https://github.com/tokio-rs/tls"
|
|
||||||
homepage = "https://github.com/tokio-rs/tls"
|
|
||||||
documentation = "https://docs.rs/tokio-rustls"
|
|
||||||
readme = "README.md"
|
|
||||||
description = "Asynchronous TLS/SSL streams for Tokio using Rustls."
|
|
||||||
categories = ["asynchronous", "cryptography", "network-programming"]
|
|
||||||
edition = "2018"
|
|
||||||
rust-version = "1.56"
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
tokio = "1.0"
|
|
||||||
rustls = { version = "0.21.0", default-features = false }
|
|
||||||
|
|
||||||
[features]
|
|
||||||
default = ["logging", "tls12"]
|
|
||||||
dangerous_configuration = ["rustls/dangerous_configuration"]
|
|
||||||
early-data = []
|
|
||||||
logging = ["rustls/logging"]
|
|
||||||
secret_extraction = ["rustls/secret_extraction"]
|
|
||||||
tls12 = ["rustls/tls12"]
|
|
||||||
|
|
||||||
[dev-dependencies]
|
|
||||||
argh = "0.1"
|
|
||||||
tokio = { version = "1.0", features = ["full"] }
|
|
||||||
futures-util = "0.3.1"
|
|
||||||
lazy_static = "1"
|
|
||||||
webpki-roots = "0.22"
|
|
||||||
rustls-pemfile = "1"
|
|
||||||
webpki = { package = "rustls-webpki", version = "0.100.0", features = ["alloc", "std"] }
|
|
@ -1,77 +0,0 @@
|
|||||||
# tokio-rustls
|
|
||||||
[![github actions](https://github.com/tokio-rs/tls/workflows/CI/badge.svg)](https://github.com/tokio-rs/tls/actions)
|
|
||||||
[![crates](https://img.shields.io/crates/v/tokio-rustls.svg)](https://crates.io/crates/tokio-rustls)
|
|
||||||
[![license](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/tokio-rs/tls/blob/master/tokio-rustls/LICENSE-MIT)
|
|
||||||
[![license](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/tokio-rs/tls/blob/master/tokio-rustls/LICENSE-APACHE)
|
|
||||||
[![docs.rs](https://docs.rs/tokio-rustls/badge.svg)](https://docs.rs/tokio-rustls)
|
|
||||||
|
|
||||||
Asynchronous TLS/SSL streams for [Tokio](https://tokio.rs/) using
|
|
||||||
[Rustls](https://github.com/rustls/rustls).
|
|
||||||
|
|
||||||
### Basic Structure of a Client
|
|
||||||
|
|
||||||
```rust
|
|
||||||
use std::sync::Arc;
|
|
||||||
use tokio::net::TcpStream;
|
|
||||||
use tokio_rustls::rustls::{ClientConfig, OwnedTrustAnchor, RootCertStore, ServerName};
|
|
||||||
use tokio_rustls::TlsConnector;
|
|
||||||
|
|
||||||
// ...
|
|
||||||
|
|
||||||
let mut root_cert_store = RootCertStore::empty();
|
|
||||||
root_cert_store.add_server_trust_anchors(webpki_roots::TLS_SERVER_ROOTS.0.iter().map(|ta| {
|
|
||||||
OwnedTrustAnchor::from_subject_spki_name_constraints(
|
|
||||||
ta.subject,
|
|
||||||
ta.spki,
|
|
||||||
ta.name_constraints,
|
|
||||||
)
|
|
||||||
}));
|
|
||||||
let config = ClientConfig::builder()
|
|
||||||
.with_safe_defaults()
|
|
||||||
.with_root_certificates(root_cert_store)
|
|
||||||
.with_no_client_auth();
|
|
||||||
let connector = TlsConnector::from(Arc::new(config));
|
|
||||||
let dnsname = ServerName::try_from("www.rust-lang.org").unwrap();
|
|
||||||
|
|
||||||
let stream = TcpStream::connect(&addr).await?;
|
|
||||||
let mut stream = connector.connect(dnsname, stream).await?;
|
|
||||||
|
|
||||||
// ...
|
|
||||||
```
|
|
||||||
|
|
||||||
### Client Example Program
|
|
||||||
|
|
||||||
See [examples/client](examples/client/src/main.rs). You can run it with:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
cd examples/client
|
|
||||||
cargo run -- hsts.badssl.com
|
|
||||||
```
|
|
||||||
|
|
||||||
### Server Example Program
|
|
||||||
|
|
||||||
See [examples/server](examples/server/src/main.rs). You can run it with:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
cd examples/server
|
|
||||||
cargo run -- 127.0.0.1:8000 --cert mycert.der --key mykey.der
|
|
||||||
```
|
|
||||||
|
|
||||||
### License & Origin
|
|
||||||
|
|
||||||
This project is licensed under either of
|
|
||||||
|
|
||||||
* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
|
||||||
https://www.apache.org/licenses/LICENSE-2.0)
|
|
||||||
* MIT license ([LICENSE-MIT](LICENSE-MIT) or
|
|
||||||
https://opensource.org/licenses/MIT)
|
|
||||||
|
|
||||||
at your option.
|
|
||||||
|
|
||||||
This started as a fork of [tokio-tls](https://github.com/tokio-rs/tokio-tls).
|
|
||||||
|
|
||||||
### Contribution
|
|
||||||
|
|
||||||
Unless you explicitly state otherwise, any contribution intentionally submitted
|
|
||||||
for inclusion in tokio-rustls by you, as defined in the Apache-2.0 license, shall be
|
|
||||||
dual licensed as above, without any additional terms or conditions.
|
|
Loading…
Reference in New Issue
Block a user