Clean up tls-related feature flags
This provides a clear and consistent interface for selecting TLS-related
features on both (xmpp and tokio-xmpp) crates. All feature checks have
been revamped. All working combinations have been tested (including a
connectivity test + --all-features docs build) using:
```
set -xeuo pipefail
features=(aws_lc_rs ring ktls,aws_lc_rs ktls,ring aws_lc_rs,ring aws_lc_rs,ring,ktls native-tls rustls-any-backend)
export RUSTFLAGS=" -D warnings"
cargo test --no-default-features
cargo test
for feature in ${features[@]}; do
echo ">>> BUILDING with $feature" 2>&1
# Running code or building examples cannot succeed with rustls-any-backend.
features="starttls,$feature"
if [ "$feature" != 'rustls-any-backend' ]; then
if ! cargo test --no-default-features --features="$features"; then
echo ">>> BUILD FAILED for tls feature set: $features" >&2
exit 1
fi
set +e
timeout -sINT -p -k 2 3 cargo run --no-default-features --features="$features" --example keep_connection -- test@hub.sotecware.net "$(pass xmpp/test@hub.sotecware.net)"
status="$?"
set -e
if [ $status -ne 0 ]; then
echo ">>> keep_connection did not shut down cleanly! (status: $status)" >&2
exit 1
fi
else
if ! cargo build --no-default-features --features="$feature"; then
echo ">>> BUILD FAILED for tls feature set: $features" >&2
exit 1
fi
fi
done
RUSTDOCFLAGS="--cfg docsrs" RUSTFLAGS="--cfg xmpprs_doc_build" cargo +nightly doc -Zrustdoc-map --all-features
```
This commit is contained in:
parent
35a30b0486
commit
fc8b581593
15 changed files with 273 additions and 135 deletions
|
|
@ -15,7 +15,7 @@ edition = "2021"
|
|||
bytes = "1"
|
||||
futures = "0.3"
|
||||
log = "0.4"
|
||||
tokio = { version = "1", features = ["net", "rt", "rt-multi-thread", "macros"] }
|
||||
tokio = { version = "1", features = ["net", "rt", "rt-multi-thread", "macros", "io-util"] }
|
||||
tokio-stream = { version = "0.1", features = ["sync"] }
|
||||
webpki-roots = { version = "0.26", optional = true }
|
||||
rustls-native-certs = { version = "0.7", optional = true }
|
||||
|
|
@ -40,21 +40,47 @@ ktls = { version = "6", optional = true }
|
|||
env_logger = { version = "0.11", default-features = false, features = ["auto-color", "humantime"] }
|
||||
# this is needed for echo-component example
|
||||
tokio = { version = "1", features = ["signal", "test-util"] }
|
||||
tokio-xmpp = { path = ".", default-features = false, features = ["insecure-tcp"]}
|
||||
tokio-xmpp = { path = ".", default-features = false, features = ["rustls-native-certs"]}
|
||||
|
||||
[[example]]
|
||||
name = "contact_addr"
|
||||
required-features = ["starttls"]
|
||||
|
||||
[[example]]
|
||||
name = "download_avatars"
|
||||
required-features = ["starttls"]
|
||||
|
||||
[[example]]
|
||||
name = "echo_bot"
|
||||
required-features = ["starttls"]
|
||||
|
||||
[[example]]
|
||||
name = "echo_component"
|
||||
required-features = ["starttls", "insecure-tcp"]
|
||||
|
||||
[[example]]
|
||||
name = "echo_server"
|
||||
required-features = ["starttls"]
|
||||
|
||||
[[example]]
|
||||
name = "keep_connection"
|
||||
required-features = ["starttls"]
|
||||
|
||||
[features]
|
||||
default = ["starttls-rust", "rustls-native-certs", "tls-rust-aws_lc_rs"]
|
||||
default = ["starttls", "aws_lc_rs", "rustls-native-certs"]
|
||||
starttls = ["dns"]
|
||||
tls-rust = ["tokio-rustls"]
|
||||
tls-rust-aws_lc_rs = ["tokio-rustls?/aws_lc_rs"]
|
||||
tls-rust-ring = ["tokio-rustls?/ring"]
|
||||
tls-rust-ktls = ["tls-rust", "ktls"]
|
||||
tls-rust-native-certs = ["tls-rust", "rustls-native-certs"]
|
||||
tls-rust-webpki-roots = ["tls-rust", "webpki-roots"]
|
||||
tls-native = ["tokio-native-tls", "native-tls"]
|
||||
starttls-native = ["starttls", "tls-native"]
|
||||
starttls-rust = ["starttls", "tls-rust"]
|
||||
insecure-tcp = ["tokio/io-util"]
|
||||
|
||||
aws_lc_rs = ["rustls-any-backend", "tokio-rustls/aws_lc_rs"]
|
||||
ring = ["rustls-any-backend", "tokio-rustls/ring"]
|
||||
native-tls = ["dep:tokio-native-tls", "dep:native-tls"]
|
||||
ktls = ["rustls-any-backend", "dep:ktls"]
|
||||
|
||||
rustls-any-backend = ["dep:tokio-rustls"]
|
||||
|
||||
rustls-native-certs = ["dep:rustls-native-certs"]
|
||||
webpki-roots = ["dep:webpki-roots"]
|
||||
|
||||
insecure-tcp = []
|
||||
syntax-highlighting = ["syntect"]
|
||||
# Enable serde support in jid crate
|
||||
serde = [ "xmpp-parsers/serde" ]
|
||||
|
|
|
|||
Loading…
Reference in a new issue