diff --git a/Cargo.lock b/Cargo.lock index dcfcba65a..dfc1e9468 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -559,7 +559,6 @@ dependencies = [ "config", "derive_builder 0.20.2", "fantoccini", - "fast-socks5", "futures", "hickory-proto", "hickory-resolver", @@ -1250,20 +1249,6 @@ dependencies = [ "webdriver", ] -[[package]] -name = "fast-socks5" -version = "0.9.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f89f36d4ee12370d30d57b16c7e190950a1a916e7dbbb5fd5a412f5ef913fe84" -dependencies = [ - "anyhow", - "async-trait", - "log", - "thiserror", - "tokio", - "tokio-stream", -] - [[package]] name = "fast_chemail" version = "0.9.6" diff --git a/core/Cargo.toml b/core/Cargo.toml index 2246bfbab..d6c8b431c 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -21,7 +21,6 @@ config = "0.14" derive_builder = "0.20" fantoccini = { version = "0.21.2" } futures = { version = "0.3.30" } -fast-socks5 = "0.9.2" hickory-proto = "0.24.0" hickory-resolver = "0.24.0" levenshtein = "1.0.5" diff --git a/core/src/lib.rs b/core/src/lib.rs index 5aaa2cdfd..23619ff59 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -23,13 +23,13 @@ //! - Email deliverability: Is an email sent to this address deliverable? //! - Syntax validation. Is the address syntactically valid? //! - DNS records validation. Does the domain of the email address have valid -//! MX DNS records? +//! MX DNS records? //! - Disposable email address (DEA) validation. Is the address provided by a -//! known disposable email address provider? +//! known disposable email address provider? //! - SMTP server validation. Can the mail exchanger of the email address -//! domain be contacted successfully? +//! domain be contacted successfully? //! - Mailbox disabled. Has this email address been disabled by the email -//! provider? +//! provider? //! - Full inbox. Is the inbox of this mailbox full? //! - Catch-all address. Is this email address a catch-all address? //! diff --git a/core/src/smtp/connect.rs b/core/src/smtp/connect.rs index 5d21ff67a..8b74fbed4 100644 --- a/core/src/smtp/connect.rs +++ b/core/src/smtp/connect.rs @@ -42,7 +42,13 @@ impl AsyncReadWrite for T {} macro_rules! try_smtp ( ($res: expr, $client: ident, $to_email: expr, $host: expr, $port: expr) => ({ if let Err(err) = $res { - log::debug!(target: LOG_TARGET, "[email={}] Closing [host={}:{}], because of error '{:?}'.", $to_email, $host, $port, err); + log::debug!( + target: LOG_TARGET, + "[email={}] Closing [host={}:{}], because of error '{:?}'.", + $to_email, + $host, + $port,err, + ); // Try to close the connection, but ignore if there's an error. let _ = $client.quit().await; @@ -63,24 +69,27 @@ async fn connect_to_host( let smtp_client = SmtpClient::new().hello_name(ClientId::Domain(input.hello_name.clone())); - let stream: BufStream> = if let Some(proxy) = &input.proxy { - let target_addr = format!("{}:{}", host, port); - let socks_stream = match (&proxy.username, &proxy.password) { - (Some(username), Some(password)) => { - Socks5Stream::connect_with_password( - (proxy.host.as_ref(), proxy.port), - target_addr, - username, - password, - ) - .await? - } - _ => Socks5Stream::connect((proxy.host.as_ref(), proxy.port), target_addr).await?, - }; - BufStream::new(Box::new(socks_stream) as Box) - } else { - let tcp_stream = TcpStream::connect(format!("{}:{}", host, port)).await?; - BufStream::new(Box::new(tcp_stream) as Box) + let stream: BufStream> = match &input.proxy { + Some(proxy) => { + let target_addr = format!("{}:{}", host, port); + let socks_stream = match (&proxy.username, &proxy.password) { + (Some(username), Some(password)) => { + Socks5Stream::connect_with_password( + (proxy.host.as_ref(), proxy.port), + target_addr, + username, + password, + ) + .await? + } + _ => Socks5Stream::connect((proxy.host.as_ref(), proxy.port), target_addr).await?, + }; + BufStream::new(Box::new(socks_stream) as Box) + } + None => { + let tcp_stream = TcpStream::connect(format!("{}:{}", host, port)).await?; + BufStream::new(Box::new(tcp_stream) as Box) + } }; let mut smtp_transport = SmtpTransport::new(smtp_client, stream).await?; @@ -218,8 +227,7 @@ async fn smtp_is_catch_all( // Create a random 15-char alphanumerical string. let mut rng = SmallRng::from_entropy(); - let random_email: String = iter::repeat(()) - .map(|()| rng.sample(Alphanumeric)) + let random_email: String = iter::repeat_with(|| rng.sample(Alphanumeric)) .map(char::from) .take(15) .collect();