Avoid enabling multiple rustls backends by accident
For this, we had to: - Make the choice(s) of backend explicit in tokio-xmpp features - Avoid picking a backend through transitive dependencies in xmpp (reqwest->hyper->rustls). In addition, we choose the default rustls backend by default and adapt the examples so that they can cope with either situation.
This commit is contained in:
parent
025e09aca6
commit
4e9e18444c
11 changed files with 134 additions and 15 deletions
|
|
@ -2,7 +2,12 @@ use futures::stream::StreamExt;
|
|||
use std::env::args;
|
||||
use std::process::exit;
|
||||
use std::str::FromStr;
|
||||
use tokio_xmpp::{rustls, Client};
|
||||
#[cfg(all(
|
||||
feature = "tls-rust",
|
||||
any(feature = "tls-rust-aws_lc_rs", feature = "tls-rust-ring")
|
||||
))]
|
||||
use tokio_xmpp::rustls;
|
||||
use tokio_xmpp::Client;
|
||||
use xmpp_parsers::jid::{BareJid, Jid};
|
||||
use xmpp_parsers::message::{Lang, Message, MessageType};
|
||||
use xmpp_parsers::presence::{Presence, Show as PresenceShow, Type as PresenceType};
|
||||
|
|
@ -11,11 +16,20 @@ use xmpp_parsers::presence::{Presence, Show as PresenceShow, Type as PresenceTyp
|
|||
async fn main() {
|
||||
env_logger::init();
|
||||
|
||||
#[cfg(feature = "tls-rust")]
|
||||
#[cfg(all(feature = "tls-rust", feature = "tls-rust-aws_lc_rs"))]
|
||||
rustls::crypto::aws_lc_rs::default_provider()
|
||||
.install_default()
|
||||
.expect("failed to install rustls crypto provider");
|
||||
|
||||
#[cfg(all(
|
||||
feature = "tls-rust",
|
||||
feature = "tls-rust-ring",
|
||||
not(feature = "tls-rust-aws_lc_rs")
|
||||
))]
|
||||
rustls::crypto::ring::default_provider()
|
||||
.install_default()
|
||||
.expect("failed to install rustls crypto provider");
|
||||
|
||||
let args: Vec<String> = args().collect();
|
||||
if args.len() != 3 {
|
||||
println!("Usage: {} <jid> <password>", args[0]);
|
||||
|
|
|
|||
Loading…
Reference in a new issue