Spf.Eval (Spfcheck v0.10.0) View Source

Functions to evaluate an SPF context.

Link to this section Summary

Functions

Given a context retrieve and evaluate the associated SPF record.

Say whether str contains the start of an SPF string.

Returns true if name is a validated name for given domain.

Link to this section Types

Specs

dns_result() :: Spf.DNS.dns_result()

Link to this section Functions

Specs

evaluate(Spf.Context.t()) :: Spf.Context.t()

Given a context retrieve and evaluate the associated SPF record.

After an (attempted) evaluation, returns an updated context where:

  • :verdict is an Spf.Context.verdict/0
  • :reason shows the SPF term responsible for the verdict
  • :explanation is the expanded explain-string (if possible and applicable)
  • :error shows what (last) error was seen (if any)
  • :ipt which maps the prefixes seen during evaluation to their source
  • :msg which lists log messages accumulated during evaluation

and other fields containing information gathered during the evaluation.

The context is passed around accumulating information and tracks the state of the evaluation. Its :log is either nil or points to a log/4-function that then called with the context, facility, severity and a message so it can dump it to screen or somewhere else.

Specs

spf?(binary()) :: boolean()

Say whether str contains the start of an SPF string.

Leading whitespace is not considered an error, although technically it is a syntax error.

Link to this function

validate?(dns_result, ip, name, domain, exact)

View Source

Specs

validate?(dns_result(), binary(), binary(), binary(), boolean()) :: boolean()

Returns true if name is a validated name for given domain.

The dns_result should contain the ip addresses associated with given name. If any of the ip adresss match the given ip, the name is a validated domain name for given domain.

If the exact flag is true, then the name is also required to end with given domain as well.

Note that when trying to validate names during the expansion of the p-macro, this flag will be false.