Documentation ¶
Index ¶
- Constants
- Variables
- func IsSPF(spf string) bool
- func LookupARec(domain string, nameserver string) (net.IP, error)
- func LookupSPF(domain string, nameserver string) (string, error)
- func MatchIP(ip net.IP, ip2 string) (bool, error)
- func MatchIPWithARec(ip net.IP, domain string, nameserver string) (bool, error)
- func MatchIPWithCIDR(ip net.IP, cidr string) (bool, error)
- func MatchIPWithMXRec(ip net.IP, domain string, nameserver string) (bool, error)
- func MatchIPWithPtrRec(ip net.IP, domain string, nameserver string) (bool, error)
- type Mechanism
- type MechanismParseContext
- type Qualifier
- type Record
- type Result
Constants ¶
const ( PassQualifier = iota // + FailQualifier // - SoftFailQualifier // ~ NeutralQualifier // ? NoneQualifier // No Mechanism matched the current ip )
A Qualifier can be -, +, ~, ?
const ( AllMechanism = iota + 1 // all IPv4Mechanism // ip4 IPv6Mechanism // ip6 AMechanism // a MXMechanism // mx PTRMechanism // ptr ExistsMechanism // exists IncludeMechanism // include RedirectMechanism // redirect )
Caution! Modifiers are also called mechanisms in this library, but they get distinguished correctly
Variables ¶
var ErrInvalidMechanism error = errors.New("invalidmechanism") // Unknwon mechanism keyword received
var ErrInvalidModifier error = errors.New("invalidmodifier") // Unknown modifier received
var ErrInvalidQualifier error = errors.New("invalidqualifier") // Other character than +, -, ~, ? for a qualifier received
var ErrNotFound error = errors.New("notfound") // DNS entry not found
var ErrOutOfRecursions = errors.New("outofrecursions") // Too many redirect or include mechanisms were called
var ErrSyntax error = errors.New("syntax") // Syntax error in ParseSPF
Functions ¶
func LookupARec ¶
Returns first a record as net.IP
Returns an error if dns name couldn't be resolved
func LookupSPF ¶
Get an SPF Record as string from a domain
Returns an error if no spf record is found or dns name couldn't be resolved
func MatchIPWithARec ¶
Checks if ip is contained in a record
Returns an error if dns name couldn't be resolved
func MatchIPWithMXRec ¶
Checks if ip is found in a record which was referenced by mx record
Returns an error if dns name couldn't be resolved
Types ¶
type Mechanism ¶
An Argument in the SPF Record They are read from left to right (Left is the most powerful one) Qualifiers determine how the ip should be treated if the mechanism matches the address
func EvaluateMechanism ¶
func EvaluateMechanism(context *MechanismParseContext) (Mechanism, error)
func EvaluateModifier ¶
func EvaluateModifier(context *MechanismParseContext) (Mechanism, error)
type MechanismParseContext ¶
type Qualifier ¶
type Qualifier int