Documentation
¶
Index ¶
Constants ¶
View Source
const ( MaxDNSLookups = 10 // any mechanism that triggers DNS counts MaxVoidLookups = 2 // DNS look‑ups returning no usable data )
Limits from RFC 7208 section 4.6.4.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CheckHostResult ¶
CheckHostResult contains the result code and optional cause returned by
type Checker ¶
type Checker struct {
Resolver *dns.Resolver
MaxLookups int
MaxVoidLookups int
Lookups int
Voids int
}
Checker implements a full RFC 7208–compliant SPF policy evaluator.
func NewChecker ¶
NewChecker returns a Checker that uses the given TXTResolver.
func (*Checker) CheckHost ¶
func (c *Checker) CheckHost(ctx context.Context, ip net.IP, domain, sender string) (CheckHostResult, error)
CheckHost implements the "check_host" algorithm from RFC 7208 section 4.6. The domain parameter is the name where SPF evaluation begins. Typically this is the EHLO hostname or the domain part of MAIL FROM. The sender parameter is the full MAIL FROM address ("<>" for bounces) and is used only for macro expansion.
type Result ¶
type Result string
Result is the outcome of an SPF evaluation (RFC 7208 section 2.6).
const ( None Result = "none" Neutral Result = "neutral" // policy exists but gives no assertion Pass Result = "pass" // client is authorized Fail Result = "fail" // client is NOT authorized SoftFail Result = "softfail" // not authorized, but weak assertion TempError Result = "temperror" // transient DNS error PermError Result = "permerror" // perm error in record or >10 look‑ups )
Click to show internal directories.
Click to hide internal directories.