Rust migration Phase 1 — implements real functionality in the previously stubbed mailer-core and mailer-security crates (38 passing tests). mailer-core: Email/EmailAddress/Attachment types, RFC 5322 MIME builder, email format validation with scoring, bounce detection (14 types, 40+ regex patterns), DSN status parsing, retry delay calculation. mailer-security: DKIM signing (RSA-SHA256) and verification, SPF checking, DMARC verification with public suffix list, DNSBL IP reputation checking (10 default servers, parallel queries), all powered by mail-auth 0.7. mailer-bin: Full CLI with validate/bounce/check-ip/verify-email/dkim-sign subcommands plus --management mode for smartrust JSON-over-stdin/stdout IPC.
32 lines
614 B
Rust
32 lines
614 B
Rust
use thiserror::Error;
|
|
|
|
/// Security-related error types.
|
|
#[derive(Debug, Error)]
|
|
pub enum SecurityError {
|
|
#[error("DKIM error: {0}")]
|
|
Dkim(String),
|
|
|
|
#[error("SPF error: {0}")]
|
|
Spf(String),
|
|
|
|
#[error("DMARC error: {0}")]
|
|
Dmarc(String),
|
|
|
|
#[error("DNS resolution error: {0}")]
|
|
Dns(String),
|
|
|
|
#[error("key error: {0}")]
|
|
Key(String),
|
|
|
|
#[error("IP reputation error: {0}")]
|
|
IpReputation(String),
|
|
|
|
#[error("parse error: {0}")]
|
|
Parse(String),
|
|
|
|
#[error("IO error: {0}")]
|
|
Io(#[from] std::io::Error),
|
|
}
|
|
|
|
pub type Result<T> = std::result::Result<T, SecurityError>;
|