Check if an email address exists without sending any email, written in Rust. Comes with a ⚙️ HTTP backend.
Rust emailemail-validationemail-validation-apiemail-verificationemail-verification-apiemail-verifierhacktoberfest
feat: Add optional timeout on proxy (env var: `RCH__PROXY__TIMEOUT_MS`) (#1595)
Amaury0e51eb686dad
diff --git a/Cargo.lock b/Cargo.lockindex 501deeea..ffb02cad 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -601,7 +601,7 @@ checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"[[package]]name = "check-if-email-exists"-version = "0.11.4"+version = "0.11.5"dependencies = ["anyhow","async-recursion",@@ -633,7 +633,7 @@ dependencies = [[[package]]name = "check-if-email-exists-cli"-version = "0.11.4"+version = "0.11.5"dependencies = ["anyhow","check-if-email-exists",@@ -3062,7 +3062,7 @@ dependencies = [[[package]]name = "reacher_backend"-version = "0.11.4"+version = "0.11.5"dependencies = ["anyhow","async-smtp",@@ -3095,7 +3095,7 @@ dependencies = [[[package]]name = "reacher_sqs"-version = "0.11.4"+version = "0.11.5"dependencies = ["check-if-email-exists","lambda_runtime",diff --git a/backend/Cargo.toml b/backend/Cargo.tomlindex b3a6019b..f94a4524 100644--- a/backend/Cargo.toml+++ b/backend/Cargo.toml@@ -1,6 +1,6 @@[package]name = "reacher_backend"-version = "0.11.4"+version = "0.11.5"edition = "2018"license = "AGPL-3.0"publish = falsediff --git a/backend/backend_config.toml b/backend/backend_config.tomlindex 6a830781..c7024531 100644--- a/backend/backend_config.toml+++ b/backend/backend_config.toml@@ -62,12 +62,14 @@ webdriver_addr = "http://localhost:9515"# - RCH__PROXY__PORT# - RCH__PROXY__USERNAME# - RCH__PROXY__PASSWORD+# - RCH__PROXY__TIMEOUT_MS## [proxy]# host = "my.proxy.com"# port = 1080# username = "my-username"# password = "my-password"+# timeout_ms = 30000[webdriver]# Path to the Chrome binary. If not set, the default system Chrome will be used.@@ -75,28 +77,6 @@ webdriver_addr = "http://localhost:9515"# Env variable: RCH__WEBDRIVER__BINARY# binary = "/usr/bin/google-chrome"-# Deprecated: use the "proxies" configuration below instead.-#-# Uncomment the lines below to define a proxy called "default". If you want to-# use a proxy, you can set the `proxy` field in the `verif_method` section-# below to "default". Not setting it will NOT apply this default proxy to-# verifications though.-#-# The username and password are optional and only needed if the proxy requires-# authentication.-#-# Env variables:-# - RCH__PROXY__HOST-# - RCH__PROXY__PORT-# - RCH__PROXY__USERNAME-# - RCH__PROXY__PASSWORD-#-# [proxy]-# host = "my.proxy.com"-# port = 1080-# username = "my-username"-# password = "my-password"-# Override verification method to use for each email provider. Each email provider can# be verified using one of the following methods:# - Gmail: smtpdiff --git a/cli/Cargo.toml b/cli/Cargo.tomlindex 62202c54..de89f5fd 100644--- a/cli/Cargo.toml+++ b/cli/Cargo.toml@@ -1,6 +1,6 @@[package]name = "check-if-email-exists-cli"-version = "0.11.4"+version = "0.11.5"default-run = "check_if_email_exists"edition = "2018"description = "Check if an email address exists without sending any email."diff --git a/cli/src/main.rs b/cli/src/main.rsindex 79467fa8..0bac6926 100644--- a/cli/src/main.rs+++ b/cli/src/main.rs@@ -84,6 +84,7 @@ async fn main() -> Result<(), anyhow::Error> {port: CONF.proxy_port,username: CONF.proxy_username.clone(),password: CONF.proxy_password.clone(),+ timeout_ms: None,});let verif_method = VerifMethod::new_with_same_config_for_all(proxy,diff --git a/core/Cargo.toml b/core/Cargo.tomlindex c82c373f..b379fe41 100644--- a/core/Cargo.toml+++ b/core/Cargo.toml@@ -1,6 +1,6 @@[package]name = "check-if-email-exists"-version = "0.11.4"+version = "0.11.5"authors = ["Amaury <[email protected]>"]categories = ["email"]description = "Check if an email address exists without sending any email"diff --git a/core/src/lib.rs b/core/src/lib.rsindex 2093758f..f8644d59 100644--- a/core/src/lib.rs+++ b/core/src/lib.rs@@ -49,7 +49,8 @@//! host: "my-proxy.io".to_string(), // Use a SOCKS5 proxy to verify the email//! port: 1080,//! username: None, // You can also set it non-empty-//! password: None+//! password: None,+//! timeout_ms: None,//! });//! let verif_method = VerifMethod {//! proxies,diff --git a/core/src/smtp/connect.rs b/core/src/smtp/connect.rsindex 38138a60..76a312b5 100644--- a/core/src/smtp/connect.rs+++ b/core/src/smtp/connect.rs@@ -74,6 +74,11 @@ async fn connect_to_smtp_host(let stream: BufStream<Box<dyn AsyncReadWrite>> = match &verif_method.proxy {Some(proxy) => {+ let mut config = Config::default();+ if let Some(timeout_ms) = proxy.timeout_ms {+ config.set_connect_timeout(timeout_ms / 1000);+ }+let socks_stream =if let (Some(username), Some(password)) = (&proxy.username, &proxy.password) {Socks5Stream::connect_with_password(@@ -82,7 +87,7 @@ async fn connect_to_smtp_host(verif_method.config.smtp_port,username.clone(),password.clone(),- Config::default(),+ config,).await?} else {@@ -90,7 +95,7 @@ async fn connect_to_smtp_host((proxy.host.as_ref(), proxy.port),clean_host.clone(),verif_method.config.smtp_port,- Config::default(),+ config,).await?};diff --git a/core/src/util/input_output.rs b/core/src/util/input_output.rsindex 929349ba..4974c407 100644--- a/core/src/util/input_output.rs+++ b/core/src/util/input_output.rs@@ -102,6 +102,8 @@ pub struct CheckEmailInputProxy {pub username: Option<String>,/// Password to pass to proxy authentication.pub password: Option<String>,+ /// The timeout for the connection to the proxy, in ms.+ pub timeout_ms: Option<u64>,}/// Builder pattern for the input argument into the main `email_exists`diff --git a/docker-compose.local.yaml b/rabbitmq/docker-compose.local.yamlsimilarity index 100%rename from docker-compose.local.yamlrename to rabbitmq/docker-compose.local.yamldiff --git a/docker-compose.yaml b/rabbitmq/docker-compose.yamlsimilarity index 100%rename from docker-compose.yamlrename to rabbitmq/docker-compose.yamldiff --git a/sqs/Cargo.toml b/sqs/Cargo.tomlindex 638f7d04..49d800cf 100644--- a/sqs/Cargo.toml+++ b/sqs/Cargo.toml@@ -1,6 +1,6 @@[package]name = "reacher_sqs"-version = "0.11.4"+version = "0.11.5"edition = "2018"license = "AGPL-3.0"publish = false