Documentation
¶
Index ¶
Constants ¶
const ( ResultNone = "none" // No SPF records found or no valid domain ResultNeutral = "neutral" // Domain explicitly states no assertion (?) ResultPass = "pass" // IP is authorized to send mail from this domain ResultFail = "fail" // IP is not authorized to send mail from this domain ResultSoftFail = "softfail" // IP is probably not authorized (weak policy) ResultTempError = "temperror" // Temporary error (DNS issues, etc.) ResultPermError = "permerror" // Permanent error (invalid SPF record, etc.) )
SPF result types as defined in RFC 7208
Variables ¶
var ErrNXDOMAIN = errors.New("nxdomain")
ErrNXDOMAIN is used to indicate that the domain does not exist (NXDOMAIN).
Functions ¶
func SPFCheck ¶
SPFCheck validates if an IP address is authorized to send emails from a specific domain Returns one of the following results as defined in RFC 7208 section 2.6: - "none": No SPF records found or no valid domain - "neutral": Domain explicitly states no assertion - "pass": IP is authorized to send mail from this domain - "fail": IP is not authorized to send mail from this domain - "softfail": IP is probably not authorized (weak policy) - "temperror": Temporary error (DNS issues, etc.) - "permerror": Permanent error (invalid SPF record, etc.)
Types ¶
type DNSResolver ¶
type DNSResolver struct {
// contains filtered or unexported fields
}
DNSResolver handles DNS lookups for SPF validation
func NewDNSResolver ¶
func NewDNSResolver(servers []string, memcacheAddr string) *DNSResolver
NewDNSResolver creates a new DNS resolver with the specified servers If memcacheAddr is an empty string, no memcache usage
type Mechanism ¶
type Mechanism struct {
Type MechanismType
Qualifier Qualifier
Domain string
IP net.IP
IPNet *net.IPNet
Prefix int
}
Mechanism represents an SPF mechanism with its qualifier and parameters
type MechanismType ¶
type MechanismType string
MechanismType represents the type of SPF mechanism
const ( MechanismAll MechanismType = "all" MechanismIP4 MechanismType = "ip4" MechanismIP6 MechanismType = "ip6" MechanismA MechanismType = "a" MechanismMX MechanismType = "mx" MechanismPTR MechanismType = "ptr" MechanismExists MechanismType = "exists" MechanismInclude MechanismType = "include" )
type SPFEvaluator ¶
type SPFEvaluator struct {
// contains filtered or unexported fields
}
SPFEvaluator handles the evaluation of SPF records
func NewSPFEvaluator ¶
func NewSPFEvaluator(resolver *DNSResolver) *SPFEvaluator
NewSPFEvaluator creates a new SPF evaluator
func (*SPFEvaluator) EvaluateSPF ¶
EvaluateSPF evaluates an SPF record for a given IP and domain