Documentation
¶
Index ¶
- Constants
- Variables
- type PermanentError
- type Resolver
- type Result
- type Session
- func (s *Session) Evaluate(ctx context.Context) (Result, error)
- func (s *Session) EvaluateMechanism(ctx context.Context, mech string) (bool, error)
- func (s *Session) EvaluatePolicy(ctx context.Context, policy string) (Result, error)
- func (s *Session) ExpandMacro(ctx context.Context, host string, forExplanation bool) (string, error)
- func (s *Session) Reset()
- type TemporaryError
- type Verifier
Constants ¶
View Source
const ( None Result = iota Neutral = iota Pass = iota Fail = iota SoftFail = iota TempError = iota PermError = iota )
View Source
const (
DefaultMaxDNSQueries uint = 10
)
View Source
const (
DefaultPolicy string = "v=spf1 -all exp=github.com/spf"
)
Variables ¶
View Source
var DefaultResolver *net.Resolver = nil
Functions ¶
This section is empty.
Types ¶
type PermanentError ¶
var ErrDomainEmptyInExistsMechanism *PermanentError = &PermanentError{
Reason: "Domain in exists mechanism is empty",
}
var ErrDomainEmptyInIncludeMechanism *PermanentError = &PermanentError{
Reason: "Domain in include mechanism is empty",
}
var ErrDomainNotValid *PermanentError = &PermanentError{
Reason: "Domain name is not valid",
}
var ErrExpandedDomainNotValid *PermanentError = &PermanentError{
Reason: "Expanded macro yields an invalid domain",
}
var ErrIPInMechanismInvalid *PermanentError = &PermanentError{
Reason: "IP address in ip4 or ip6 mechanism is not a valid IP address",
}
var ErrMaxDNSQueries *PermanentError = &PermanentError{
Reason: "Maximum number of DNS queries reached",
}
func (*PermanentError) Error ¶
func (e *PermanentError) Error() string
type Session ¶
type Session struct {
Parent *Session
Verifier *Verifier
Domain string
// DNSQueries is the number of times a DNS query was executed
DNSQueries uint
Mechanisms []string
Explanation string
}
func (*Session) EvaluateMechanism ¶
func (*Session) EvaluatePolicy ¶
func (*Session) ExpandMacro ¶
type TemporaryError ¶
func (*TemporaryError) Error ¶
func (e *TemporaryError) Error() string
type Verifier ¶
type Verifier struct {
// Resolver is the DNS resolver this verifier should use
Resolver Resolver
// DefaultPolicy is the default SPF policy to use if there was none found on the domain
DefaultPolicy string
// Maximum number of DNS queries
MaxDNSQueries uint
// ServerIP is the IP address of the SMTP server
ServerIP net.IP
// ClientIP is the IP address of the SMTP client
ClientIP net.IP
// FROM is the full address of the MAIL FROM:<addr> command
FROM string
// EHLO is the advertized domain in the EHLO/HELO command
EHLO string
// SMTP is the domain name of the SMTP service
SMTP string
// Timestamp is the timestamp of verification
Timestamp time.Time
}
func NewVerifierWithDefaults ¶
func NewVerifierWithDefaults() *Verifier
Click to show internal directories.
Click to hide internal directories.