Component is now behind insecure-tcp feature flag

This commit is contained in:
xmppftw xmppftw 2024-08-10 17:39:55 +02:00
commit 9f4af1625d
4 changed files with 11 additions and 19 deletions

View file

@ -16,8 +16,6 @@ use crate::Error;
#[cfg(any(feature = "starttls", feature = "insecure-tcp"))]
use crate::connect::DnsConfig;
#[cfg(feature = "starttls")]
use crate::connect::StartTlsServerConnector;
#[cfg(feature = "insecure-tcp")]
use crate::connect::TcpServerConnector;
@ -52,20 +50,11 @@ impl Component<TcpServerConnector> {
}
}
#[cfg(feature = "starttls")]
impl Component<StartTlsServerConnector> {
/// Start a new XMPP component over StartTLS
pub async fn new_starttls(
jid: &str,
password: &str,
dns_config: DnsConfig,
) -> Result<Self, Error> {
Self::new_with_connector(jid, password, StartTlsServerConnector::from(dns_config)).await
}
}
impl<C: ServerConnector> Component<C> {
/// Start a new XMPP component
/// Start a new XMPP component.
///
/// Unfortunately [`StartTlsConnector`] is not supported yet. The tracking issue is
/// [#143](https://gitlab.com/xmpp-rs/xmpp-rs/-/issues/143).
pub async fn new_with_connector(
jid: &str,
password: &str,

View file

@ -40,13 +40,11 @@ use crate::{
connect::{DnsConfig, ServerConnector, ServerConnectorError},
error::{Error, ProtocolError},
proto::{Packet, XmppStream},
Client, Component,
Client,
};
/// Client that connects over StartTls
pub type StartTlsClient = Client<StartTlsServerConnector>;
/// Component that connects over StartTls
pub type StartTlsComponent = Component<StartTlsServerConnector>;
/// Connect via TCP+StartTLS to an XMPP server
#[derive(Debug, Clone)]

View file

@ -53,7 +53,10 @@ pub mod connect;
pub mod proto;
pub use client::async_client::Client;
#[cfg(feature = "insecure-tcp")]
mod component;
#[cfg(feature = "insecure-tcp")]
pub use crate::component::Component;
/// Detailed error types
pub mod error;