Skip to content

Check if an email address exists without sending any email, written in Rust. Comes with a ⚙️ HTTP backend.

feat: Add proxy_host and proxy_port info to HTTP (#770)

Amaury123f431e10e9
diff --git a/src/http.rs b/src/http.rs
index 85179acb..9b0db180 100644
--- a/src/http.rs
+++ b/src/http.rs
@@ -26,6 +26,8 @@ pub struct PostReqBody {
from_email: Option<String>,
hello_name: Option<String>,
to_emails: Vec<String>,
+ proxy_host: Option<String>,
+ proxy_port: Option<u16>,
}
/// Error Response from POST /
@@ -59,6 +61,11 @@ async fn req_handler(req: Request<Body>) -> Result<Response<Body>, hyper::Error>
let mut input = CheckEmailInput::new(body.to_emails);
input.from_email(body.from_email.unwrap_or_else(|| "[email protected]".into())).hello_name(body.hello_name.unwrap_or_else(|| "localhost".into()));
+ // Add proxy if both fields `proxy_host` and `proxy_port` are set.
+ if let (Some(proxy_host), Some(proxy_port)) = (body.proxy_host, body.proxy_port) {
+ input.proxy(proxy_host, proxy_port);
+ }
+
let body = check_email(&input).await;
let body = match serde_json::to_string(&body) {
Ok(b) => b,