mailguard_rs/
lib.rs

1//! MailGuard-RS: Fast temporary email detection Rust library
2//!
3//! Detect temporary emails and malicious domains by querying SURBL DNS records.
4
5pub mod cache;
6pub mod detector;
7pub mod dns;
8pub mod error;
9pub mod threat;
10
11pub use detector::{DomainStatus, EmailStatus, MailGuard, MailGuardConfig};
12pub use error::MailGuardError;
13pub use threat::ThreatType;
14
15/// Check a single email address
16///
17/// # Example
18///
19/// ```rust
20/// use mailguard_rs::check_email;
21///
22/// #[tokio::main]
23/// async fn main() -> Result<(), Box<dyn std::error::Error>> {
24///     let status = check_email("test@tempmail.com").await?;
25///     println!("Email status: {:?}", status);
26///     Ok(())
27/// }
28/// ```
29pub async fn check_email(email: &str) -> Result<EmailStatus, MailGuardError> {
30    let detector = MailGuard::new();
31    detector.check_email(email).await
32}
33
34/// Check domain
35pub async fn check_domain(domain: &str) -> Result<DomainStatus, MailGuardError> {
36    let detector = MailGuard::new();
37    detector.check_domain(domain).await
38}
39
40/// Batch check emails
41pub async fn check_emails_batch(emails: &[&str]) -> Vec<Result<EmailStatus, MailGuardError>> {
42    let detector = MailGuard::new();
43    detector.check_emails_batch(emails).await
44}