Skip to main content

mailrs_shield/
lib.rs

1//! SMTP anti-spam primitives: DNSBL, greylisting, and FCrDNS.
2//!
3//! Three independent modules used by inbound SMTP pipelines to filter
4//! unwanted mail at connect / sender-evaluation time:
5//!
6//! - [`dnsbl`] — query DNS-based blocklists (Spamhaus, Barracuda, …)
7//!   for an inbound client IP, with an in-process TTL cache.
8//! - [`greylist`] — temporary 4xx-defer policy ([Harris 2003] / RFC
9//!   6647): unknown sender triplets get one initial defer; legitimate
10//!   senders retry, spammers don't. Comes with an optional Redis-backed
11//!   store ([`greylist::GreylistDb`]) behind the default `redis-store`
12//!   feature.
13//! - [`ptr`] — forward-confirmed reverse DNS (FCrDNS) score for an
14//!   inbound client: 0.0 if PTR → forward roundtrip matches the EHLO
15//!   domain, 1.0 if it doesn't.
16//!
17//! ## Feature flags
18//!
19//! - `redis-store` (default) — enables the Redis-backed
20//!   [`greylist::GreylistDb`] store (with optional Postgres cold backup).
21//!   Disable to plug in your own store.
22//!
23//! [Harris 2003]: https://projects.puremagic.com/greylisting/
24
25pub mod dnsbl;
26pub mod greylist;
27pub mod ptr;