tokio-xmpp: simplify examples by requiring specific TLS features
This commit is contained in:
parent
fc8b581593
commit
e3a4aae42d
6 changed files with 4 additions and 74 deletions
|
|
@ -2,7 +2,6 @@ use futures::stream::StreamExt;
|
|||
use std::env::args;
|
||||
use std::process::exit;
|
||||
use std::str::FromStr;
|
||||
#[cfg(feature = "rustls-any-backend")]
|
||||
use tokio_xmpp::rustls;
|
||||
use tokio_xmpp::{Client, IqRequest, IqResponse};
|
||||
use xmpp_parsers::{
|
||||
|
|
@ -12,26 +11,14 @@ use xmpp_parsers::{
|
|||
server_info::ServerInfo,
|
||||
};
|
||||
|
||||
#[cfg(all(
|
||||
feature = "rustls-any-backend",
|
||||
not(any(feature = "aws_lc_rs", feature = "ring"))
|
||||
))]
|
||||
compile_error!("using rustls (e.g. via the ktls feature) needs an enabled rustls backend feature (either aws_lc_rs or ring).");
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
env_logger::init();
|
||||
|
||||
#[cfg(all(feature = "aws_lc_rs", not(feature = "ring")))]
|
||||
rustls::crypto::aws_lc_rs::default_provider()
|
||||
.install_default()
|
||||
.expect("failed to install rustls crypto provider");
|
||||
|
||||
#[cfg(all(feature = "ring"))]
|
||||
rustls::crypto::ring::default_provider()
|
||||
.install_default()
|
||||
.expect("failed to install rustls crypto provider");
|
||||
|
||||
let args: Vec<String> = args().collect();
|
||||
if args.len() != 4 {
|
||||
println!("Usage: {} <jid> <password> <target>", args[0]);
|
||||
|
|
|
|||
Loading…
Reference in a new issue