Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connecting to SOCKS5 Proxy #217

Open
gitvitox opened this issue Oct 28, 2021 · 1 comment
Open

Connecting to SOCKS5 Proxy #217

gitvitox opened this issue Oct 28, 2021 · 1 comment

Comments

@gitvitox
Copy link

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()),
    }
@jonhoo
Copy link
Owner

jonhoo commented Nov 6, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants