Skip to content

Commit 66ab640

Browse files
committed
Stop automatically pulling in aws-lc as a dependency
1 parent bdd9432 commit 66ab640

File tree

3 files changed

+41
-4
lines changed

3 files changed

+41
-4
lines changed

Cargo.toml

+4-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ license = "Apache-2.0"
1010
[features]
1111
default = ["tokio-net"]
1212
rustls = ["tokio-rustls"]
13+
rustls-aws-lc = ["rustls", "tokio-rustls/aws-lc-rs"]
14+
rustls-fips = ["rustls-aws-lc", "tokio-rustls/fips"]
15+
rustls-ring = ["rustls", "tokio-rustls/ring"]
1316
native-tls = ["tokio-native-tls"]
1417
openssl = ["tokio-openssl", "openssl_impl"]
1518
rt = ["tokio/rt"]
@@ -22,7 +25,7 @@ pin-project-lite = "0.2.13"
2225
thiserror = "1.0.30"
2326
tokio = { version = "1.0", features = ["time"] }
2427
tokio-native-tls = { version = "0.3.0", optional = true }
25-
tokio-rustls = { version = ">=0.25.0,<0.27", optional = true }
28+
tokio-rustls = { version = ">=0.25.0,<0.27", default-features = false, optional = true }
2629
tokio-openssl = { version = "0.6.3", optional = true }
2730
openssl_impl = { package = "openssl", version = "0.10.32", optional = true }
2831

README.md

+36-2
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,39 @@ It can be used to easily create a `Stream` of TLS connections from a listening s
1313

1414
See examples for examples of usage.
1515

16-
You must enable either one of the `rustls`, `native-tls`, or `openssl` features depending on which implementation you
17-
would like to use.
16+
You must enable either one of the `rustls[-xyz]` (more details below), `native-tls`, or `openssl`
17+
features depending on which implementation you would like to use.
18+
19+
When enabling the `rustls` feature, the `rustls` crate will be added as a dependency through
20+
the `tokio-rustls` crate without any
21+
[cryptography providers](https://docs.rs/rustls/latest/rustls/#cryptography-providers)
22+
included by default. To include one, do either of the following:
23+
24+
1. Enable at least one of the additional `rustls-aws-lc`, `rustls-fips`, or `rustls-ring` features.
25+
By doing this, you can also remove the `rustls` feature flag since it will be enabled
26+
automatically by any of the `rustls-xyz` features.
27+
28+
```toml
29+
# Replace `rustls-xyz` with one of the features mentioned above.
30+
tls-listener = { version = "x", features = ["rustls-xyz"] }
31+
```
32+
33+
These features will enable their relevant [`rustls` features](https://docs.rs/rustls/latest/rustls/#crate-features).
34+
35+
1. Keep the `rustls` feature flag, but directly add the [`rustls`](https://crates.io/crates/rustls)
36+
and/or [`tokio-rustls`](https://crates.io/crates/tokio-rustls) crates to your project's
37+
dependencies and enable your preferred flags on them instead of adding additional flags on
38+
this crate (`tls-listener`).
39+
40+
```toml
41+
# Replace `xyz` with one of the features mentioned in the crate's documentation.
42+
# for example: `aws-lc-rc`, `fips` or `ring`
43+
rustls = { version = "x", default-features = false, features = ["xyz"]}
44+
# And/or
45+
tokio-rustls = { version = "x", default-features = false, features = ["xyz"]}
46+
```
47+
48+
You can also enable the default features by removing `default-features = false`, which will
49+
enable the [AWS-LC crypto provider](https://github.com/aws/aws-lc-rs). However, their
50+
default features are not enable by `tls-listener` because doing so will make disabling
51+
them very hard for dependent crates.

examples/test_examples.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def build_examples():
5656
"build",
5757
"--examples",
5858
"--features",
59-
"rustls,rt,tokio/rt-multi-thread",
59+
"rustls-aws-lc,rt,tokio/rt-multi-thread",
6060
]
6161
)
6262
proc.check_returncode()

0 commit comments

Comments
 (0)