Crate viaspf

Source
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§

lookup
Abstractions for DNS lookups.
trace
Tracing information gathered during SPF query execution.

Structs§

Config
An SPF query configuration.
ConfigBuilder
A builder for SPF query configurations.
DomainName
A syntactically valid, normalised domain name.
ExpansionResult
The result of macro-expanding an explain string.
ParseParamError
An error indicating that a query parameter could not be parsed.
QueryResult
The result of evaluating an SPF query.
Sender
A sender identity.

Enums§

ErrorCause
Causes of an SPF query error result.
EvalError
Errors that may occur during query evaluation.
ExplanationString
An explanation of why a query evaluated to a Fail result.
SpfResult
The result of an SPF evaluation.
SpfResultCause
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.