mirror of
https://gitlab.com/xmpp-rs/xmpp-rs.git
synced 2024-07-12 22:21:53 +00:00
added more channel binding infrastructure
This commit is contained in:
parent
6579ce6563
commit
a88d9aa566
2 changed files with 13 additions and 2 deletions
|
@ -68,11 +68,12 @@ impl ClientBuilder {
|
|||
/// Connects to the server and returns a `Client` when succesful.
|
||||
pub fn connect(self) -> Result<Client, Error> {
|
||||
let host = &self.host.unwrap_or(self.jid.domain.clone());
|
||||
// TODO: channel binding
|
||||
let mut transport = SslTransport::connect(host, self.port)?;
|
||||
C2S::init(&mut transport, &self.jid.domain, "before_sasl")?;
|
||||
let (sender_out, sender_in) = channel();
|
||||
let (dispatcher_out, dispatcher_in) = channel();
|
||||
let mut credentials = self.credentials.expect("can't connect without credentials");
|
||||
credentials.channel_binding = transport.channel_bind();
|
||||
let mut client = Client {
|
||||
jid: self.jid,
|
||||
transport: transport,
|
||||
|
@ -81,7 +82,7 @@ impl ClientBuilder {
|
|||
sender_in: sender_in,
|
||||
dispatcher_in: dispatcher_in,
|
||||
};
|
||||
client.connect(self.credentials.expect("can't connect without credentials"))?;
|
||||
client.connect(credentials)?;
|
||||
client.bind()?;
|
||||
Ok(client)
|
||||
}
|
||||
|
|
|
@ -35,6 +35,11 @@ pub trait Transport {
|
|||
|
||||
/// Resets the stream.
|
||||
fn reset_stream(&mut self);
|
||||
|
||||
/// Gets channel binding data.
|
||||
fn channel_bind(&self) -> Option<Vec<u8>> {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
/// A transport which uses STARTTLS.
|
||||
|
@ -73,6 +78,11 @@ impl Transport for SslTransport {
|
|||
.. Default::default()
|
||||
});
|
||||
}
|
||||
|
||||
fn channel_bind(&self) -> Option<Vec<u8>> {
|
||||
// TODO: channel binding
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
impl SslTransport {
|
||||
|
|
Loading…
Reference in a new issue