Expand description
A library implementing the Sender Policy Framework (SPF) specification, version 1, described in RFC 7208.
This library provides an API for checking whether an email sending host is authorised to use some mail domain according to SPF policy published in the DNS.
§Usage
The function evaluate_sender
is the main public API item. It allows
checking the MAIL FROM and HELO identities according to the specification.
In addition, the function expand_explain_string
allows performing macro
expansion on explain strings (macro strings).
The above functions both require to be passed a Lookup
implementation,
which serves as a DNS resolver. The Lookup
trait
allows you to plug in any DNS resolver yourself, by providing an appropriate
implementation. See the module lookup
for more.
As a convenience, a Lookup
implementation for the Trust-DNS resolver can
be made available by enabling the Cargo feature trust-dns-resolver
.
§Cargo features
The feature trust-dns-resolver
can be enabled to make a Lookup
implementation available for the asynchronous Tokio-based
trust_dns_resolver::TokioAsyncResolver
.
The default feature tokio-timeout
enables timeout logic using the
Tokio time
module. With this feature, the query functions will abort
after the configured timeout. If you want to use a different async runtime,
you can disable this feature and implement timeouts yourself (for example,
as part of the Lookup
implementation). Thus you can use this library
without depending on Tokio at all.
Re-exports§
pub use viaspf_record as record;
Modules§
Structs§
- Config
- An SPF query configuration.
- Config
Builder - A builder for SPF query configurations.
- Domain
Name - A syntactically valid, normalised domain name.
- Expansion
Result - The result of macro-expanding an explain string.
- Parse
Param Error - An error indicating that a query parameter could not be parsed.
- Query
Result - The result of evaluating an SPF query.
- Sender
- A sender identity.
Enums§
- Error
Cause - Causes of an SPF query error result.
- Eval
Error - Errors that may occur during query evaluation.
- Explanation
String - An explanation of why a query evaluated to a
Fail
result. - SpfResult
- The result of an SPF evaluation.
- SpfResult
Cause - The cause that led to an SPF result.
Functions§
- evaluate_
sender - Performs an SPF query and evaluation for some sender identity.
- expand_
explain_ string - Performs macro expansion on an explain string.