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:
Jonas Schäfer 2025-05-10 10:45:43 +02:00
commit fc8b581593
15 changed files with 273 additions and 135 deletions

View file

@ -25,13 +25,15 @@ XXXX-YY-ZZ RELEASER <admin@example.com>
- `Component` is now gated behind `insecure-tcp` feature flag
- `XMPPStream` and `XmppCodec` were removed in favour of the newly
implemented `tokio_xmpp::xmlstream module.
- The `starttls-rust`, `tls-rust` and `tls-rust-ktls` feature flags do
not automatically enable a `rustls` crypto provider anymore. This is
to avoid conflict between two crypto providers and to avoid linking
unnecessary code. The `aws_lc_rs` crypto provider is still built by
default, however, applications which use `tokio_xmpp` without default
features will have to adapt their feature flags to explicitly enable
the `tls-rust-aws_lc_rs` or `tls-rust-ring` features. (!581)
- The TLS-related feature flags have been completely reworked to make
them easier to use. The `tls-rust-*`, `tls-native` and `starttls-*`
feature flags have been removed in favour of more concise flag names
identifying the TLS backends directly (`aws_lc_rs`, `ring`,
`native-tls`). The `starttls` feature is now independent of the
specific backend (but a backend still needs to be enabled for
compilation to succeed).
Please refer to the crate docs for details. (!581)
* Added:
- Support for sending IQ requests while tracking their responses in a
Future.