Use ServerConfig enum for tokio-xmpp client config

And expose connect_to_host from happy_eyeballs to let clients explicitly
choose to use SRV or not. (Rename connect to connect_with_srv)
This commit is contained in:
Paul Fariello 2020-12-06 15:23:29 +01:00
commit 7b4a6e3ace
4 changed files with 43 additions and 27 deletions

View file

@ -11,7 +11,7 @@ use xmpp_parsers::{ns, Element, Jid};
use super::auth::auth;
use super::bind::bind;
use crate::happy_eyeballs::connect;
use crate::happy_eyeballs::connect_with_srv;
use crate::starttls::starttls;
use crate::xmpp_codec::Packet;
use crate::xmpp_stream;
@ -47,7 +47,7 @@ impl Client {
let domain = idna::domain_to_ascii(&jid.clone().domain()).map_err(|_| Error::Idna)?;
// TCP connection
let tcp_stream = connect(&domain, Some("_xmpp-client._tcp"), 5222).await?;
let tcp_stream = connect_with_srv(&domain, Some("_xmpp-client._tcp"), 5222).await?;
// Unencryped XMPPStream
let xmpp_stream =