Categorygithub.com/redsift/spf/v2
modulepackage
2.4.1
Repository: https://github.com/redsift/spf.git
Documentation: pkg.go.dev

# README

Sender Policy Framework

A comprehensive RFC7208 implementation

Build Status Go Report Card GoDoc

About

The SPF Library implements Sender Policy Framework described in RFC 7208. It aims to cover all rough edge cases from RFC 7208. Hence, the library does not operate on strings only, rather "understands" SPF records and reacts properly to valid and invalid input. Wherever I found it useful, I added comments with RFC sections and quotes directly in the source code, so the readers can follow implemented logic.

Current status

The library is still under development. API may change, including function/methods names and signatures. I will consider it correct and stable once it passess all tests described in the most popular SPF implementation - pyspf.

Testing

Testing is an important part of this implementation. There are unit tests that will run locally in your environment, however there are also configuration files for named DNS server that would be able to respond implemented testcases. (In fact, for the long time I used a real DNS server with such configuration as a testing infrastructure for my code). There is a plan to implement simple DNS server that would be able to read .yaml files with comprehensive testsuite defined in pyspf package. Code coverage is also important part of the development and the aim is to keep it as high as 9x %

Dependencies

SPF library depends on another DNS library. Sadly, Go's builtin DNS library is not elastic enough and does not allow for controlling underlying DNS queries/responses.

Pull requests & code review

If you have any comments about code structure feel free to reach out or simply make a Pull Request

redsift/spf fork

It started as a PR to the original lib, but eventually we added some functionality, that might not be backward compatible with it, and thus we consider it as mostly separate project.

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Functions

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
CheckHost is a main entrypoint function evaluating e-mail with regard to SPF and it utilizes DNSResolver as a resolver.
No description provided by the author
No description provided by the author
FilterSPFCandidates filters a slice of strings and returns two separate slices: 1.
HasSPFPrefix checks if a given string represents a valid SPF record according to RFC 7208.
No description provided by the author
No description provided by the author
No description provided by the author
IsSPFCandidate checks if a string matches the pattern: [WS* v] WS* (=|:) WS* spf (case-insensitive) where WS* represents zero or more whitespace characters, and the 'v' part is optional.
No description provided by the author
No description provided by the author
No description provided by the author
MiekgDNSParallelism change parallelism level of matching IP and MX Anything less than 1 used as unlimited.
NewLimitedResolver returns a resolver which will pass up to lookupLimit calls to r.
NewMiekgDNSResolver returns new instance of Resolver with default dns.Client.
No description provided by the author
No description provided by the author
NewRetryResolver implements round-robin retry with backoff delay.
No description provided by the author
NormalizeFQDN appends a root domain (a dot) to the FQDN.
PartialMacros triggers partial macro expansion.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Constants

Fail result is an explicit statement that the client is not authorized to use the domain in the given identity.
Neutral result means the ADMD has explicitly stated that it is not asserting whether the IP address is authorized.
None means either (a) no syntactically valid DNS domain name was extracted from the SMTP session that could be used as the one to be authorized, or (b) no SPF records were retrieved from the DNS.
Pass result is an explicit statement that the client is authorized to inject mail with the given identity.
Permerror result means the domain's published records could not be correctly interpreted.
Softfail result is a weak statement by the publishing ADMD that the host is probably not authorized.
Temperror result means the SPF verifier encountered a transient (generally DNS) error while performing the check.
UnknownModifierMech constructed so we break policy if someone tries to create a policy out of mechanism string function instead of using actual key.

# Variables

Errors could be used for root couse analysis.
Errors could be used for root couse analysis.
Errors could be used for root couse analysis.
Errors could be used for root couse analysis.
Errors could be used for root couse analysis.
Errors could be used for root couse analysis.
Errors could be used for root couse analysis.
Errors could be used for root couse analysis.
Errors could be used for root couse analysis.
Errors could be used for root couse analysis.
Errors could be used for root couse analysis.
Errors could be used for root couse analysis.
Errors could be used for root couse analysis.
Errors could be used for root couse analysis.
Errors could be used for root couse analysis.
Errors could be used for root couse analysis.

# Structs

DNSResolver implements Resolver using local DNS.
DomainError represents a domain check error.
LimitedResolver wraps a Resolver and limits number of lookups possible to do with it.
No description provided by the author
ResponseExtras contains additional information returned alongside DNS query results.
SpfError represents errors created from parsing or validation, it holds reference to faulty token as well as error describing fault.
Trace holds data for "Received-SPF" header field https://tools.ietf.org/html/rfc7208#section-9.1.

# Interfaces

Listener interface defines callbacks for tracking SPF processing events.
Resolver provides an abstraction for DNS layer operations.

# Type aliases

No description provided by the author
IPMatcherFunc returns true if ip matches to implemented rules.
No description provided by the author
Option sets an optional parameter for the evaluating e-mail with regard to SPF.
Result represents result of SPF evaluation as it defined by RFC7208 https://tools.ietf.org/html/rfc7208#section-2.6.
No description provided by the author