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
|
|
@ -6,30 +6,12 @@ use xmpp_parsers::jid::Jid;
|
|||
use xmpp_parsers::message::{Lang, Message, MessageType};
|
||||
use xmpp_parsers::presence::{Presence, Show as PresenceShow, Type as PresenceType};
|
||||
|
||||
#[cfg(feature = "rustls-any-backend")]
|
||||
use tokio_xmpp::rustls;
|
||||
use tokio_xmpp::{connect::DnsConfig, Component};
|
||||
|
||||
#[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() < 3 || args.len() > 4 {
|
||||
println!("Usage: {} <jid> <password> [server:port]", args[0]);
|
||||
|
|
|
|||
Loading…
Reference in a new issue