Merge pull request #28 from mehcode/master

prepare for native-tls 0.2
pull/29/head
Alexey Galakhov 7 years ago committed by GitHub
commit fb346ad750
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      Cargo.toml
  2. 4
      src/client.rs

@ -34,3 +34,6 @@ version = "0.1.5"
[dev-dependencies]
env_logger = "0.5.3"
[patch.crates-io]
native-tls = { git = "https://github.com/sfackler/rust-native-tls.git" }

@ -25,11 +25,11 @@ mod encryption {
match mode {
Mode::Plain => Ok(StreamSwitcher::Plain(stream)),
Mode::Tls => {
let connector = TlsConnector::builder()?.build()?;
let connector = TlsConnector::builder().build()?;
connector.connect(domain, stream)
.map_err(|e| match e {
TlsHandshakeError::Failure(f) => f.into(),
TlsHandshakeError::Interrupted(_) => panic!("Bug: TLS handshake not blocked"),
TlsHandshakeError::WouldBlock(_) => panic!("Bug: TLS handshake not blocked"),
})
.map(StreamSwitcher::Tls)
}

Loading…
Cancel
Save