tokio-xmpp: Refactor to provide channel-binding for ktls
Instead of having a second method to fetch channel-binding from the TlsStream, do it directly in the connect() method, since after that we don’t have enough information to fetch it any longer when using ktls.
This commit is contained in:
parent
7991cef904
commit
897c2abe0b
5 changed files with 61 additions and 77 deletions
|
|
@ -5,7 +5,7 @@ use std::borrow::Cow;
|
|||
use tokio::{io::BufStream, net::TcpStream};
|
||||
|
||||
use crate::{
|
||||
connect::{DnsConfig, ServerConnector},
|
||||
connect::{ChannelBinding, DnsConfig, ServerConnector},
|
||||
xmlstream::{initiate_stream, PendingFeaturesRecv, StreamHeader, Timeouts},
|
||||
Client, Component, Error,
|
||||
};
|
||||
|
|
@ -37,18 +37,21 @@ impl ServerConnector for TcpServerConnector {
|
|||
jid: &xmpp_parsers::jid::Jid,
|
||||
ns: &'static str,
|
||||
timeouts: Timeouts,
|
||||
) -> Result<PendingFeaturesRecv<Self::Stream>, Error> {
|
||||
) -> Result<(PendingFeaturesRecv<Self::Stream>, ChannelBinding), Error> {
|
||||
let stream = BufStream::new(self.0.resolve().await?);
|
||||
Ok(initiate_stream(
|
||||
stream,
|
||||
ns,
|
||||
StreamHeader {
|
||||
to: Some(Cow::Borrowed(jid.domain().as_str())),
|
||||
from: None,
|
||||
id: None,
|
||||
},
|
||||
timeouts,
|
||||
)
|
||||
.await?)
|
||||
Ok((
|
||||
initiate_stream(
|
||||
stream,
|
||||
ns,
|
||||
StreamHeader {
|
||||
to: Some(Cow::Borrowed(jid.domain().as_str())),
|
||||
from: None,
|
||||
id: None,
|
||||
},
|
||||
timeouts,
|
||||
)
|
||||
.await?,
|
||||
ChannelBinding::None,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue