Skip to main content

mailrs_shield/
lib.rs

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