Connecting to SOCKS5 Proxy
gitvitox opened this issue · comments
gitvitox commented
Im trying to connect to IMAP through a SOCKS5 proxy. I'm using the socks crate for this.
I'm getting following error when trying to connect: unexpected EOF during handshake
This is what I tried:
let socks_stream = socks::Socks5Stream::connect(
"127.0.0.1:5000",
format!("{}:{}", imap_server, 993).as_str(),
)
.unwrap();
let client = imap::ClientBuilder::new(imap_server, 993)
.connect(|domain, stream| {
let ssl_conn = tls();
Ok(
native_tls::TlsConnector::connect(&ssl_conn, domain, socks_stream.into_inner())
.unwrap(),
)
})
.expect("Error");
match client.login(email, password).map_err(|e| e.0) {
Ok(imap_session) => Ok(imap_session),
Err(e) => Err(e.to_string()),
}
Jon Gjengset commented
Hmm, that definitely does seem suspicious. I would try a debug print of e
to see if that gives you more info, and also set client.debug = true
to get a trace of the interactions with the server.