decon_spf/
lib.rs

1#![forbid(unsafe_code)]
2#![warn(missing_docs)]
3#![cfg_attr(docsrs, feature(doc_cfg))]
4//! This crate is responsible for providing tools to parse and validate Spf Records.
5//! When the `builder` features is enabled access to the [SpfBuilder] struct and related
6//! functions is provided.
7//!
8//! For a list of supported *Modifiers* and *Mechanism*. See [`Kind`](mechanism::Kind)
9//!
10//! This crate is able to deconstruct `v=spf1` and `spf2.0` records. *Note:* Spf2.0 records are
11//! essentially defunct are its support is for historical reasons and may be removed in a future release.
12//!
13//! # Abilities:
14//! - Check and Set Spf record version. See: [`Spf Versions`](SpfBuilder::set_v1)
15//! - Check and Create Spf Mechanism/Modifiers:
16//!     - [`Mechanism`](mechanism::Mechanism)
17//!     - [`Mechanism::Qualifier`](mechanism::Mechanism::is_pass)
18//!     - [`Mechanism::Kind`](mechanism::Mechanism::kind)
19//!
20//! # Feature Flags:
21//! - `ptr` (Enabled by default.)\
22//!   The `ptr` mechanism is highly discouraged. If you want to allow it without warnings, then you
23//! should provide the `--no-default-features` option.
24//! - `strict-dns` (Disabled by default.)
25//!   This enables syntactical checking of Domain Names.
26//!     - When enabled it changes the behaviour of `FromStr` for `Mechanism<String>` and
27//! `ParsedMechanism`. By default, `rrdata` is not checked.\
28//!   When `strict-dns` is enabled an invalid domain host will be seen as **Hard** error.
29//! Any additional parsing will be halted.
30//! - `builder` (Disabled by default.)\
31//!   This enables the use of [SpfBuilder] and its related features\
32//!   You are able to convert and `Spf<String>` `into()` an `SpfBuilder` Struct.
33//! - `spf2` (Disabled by default)  
34//!   This enables the ability to programmatically create Spf2 (SenderID) records. As this
35//!   has become defunct. There is no real need for it. But it remains as an option if desired.
36//! - `serde` (Disabled by default.)
37//!
38mod core;
39mod spf;
40
41#[cfg(feature = "builder")]
42pub use crate::spf::builder::{Builder, Parsed, SpfBuilder};
43pub use crate::spf::errors::SpfErrors;
44pub use crate::spf::{Spf, SpfError};
45pub use spf::mechanism::{self};