Documentation
¶
Overview ¶
Package spf provides types for building an SPF DNS TXT record.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatMechanism ¶
FormatMechanism formats a single mechanism as "<qualifier><name>:<value>" entries (space-separated when it has multiple values), e.g. "ip4:1.2.3.4".
func FormatMechanisms ¶ added in v0.45.1
FormatMechanisms formats each mechanism (see FormatMechanism) and joins the non-empty results with a space.
func IPMechanisms ¶ added in v0.45.1
IPMechanisms splits values (a mix of IPv4 and IPv6 addresses) into a separate "ip4" mechanism and "ip6" mechanism, either of which is nil if no addresses of that family were present.
Types ¶
type Mechanism ¶
type Mechanism struct {
Qualifier Qualifier `mapstructure:"qualifier"`
Name string `mapstructure:"name"`
Values []string `mapstructure:"values"`
ValueList string `mapstructure:"value-list"`
ValuesFunc MechanismValuesFunc `json:"-" mapstructure:"-"`
}
Mechanism represents an SPF mechanism in a DNS record.
func AMechanism ¶
AMechanism returns an "a" mechanism listing values.
func IP4Mechanism ¶
IP4Mechanism returns an "ip4" mechanism listing values.
func IP6Mechanism ¶
IP6Mechanism returns an "ip6" mechanism listing values.
func IncludeMechanism ¶
IncludeMechanism returns an "include" mechanism listing values.
func MXMechanism ¶
MXMechanism returns an "mx" mechanism listing values.
type MechanismValuesFunc ¶
type MechanismValuesFunc func() []string
MechanismValuesFunc is a function type that returns mechanism values.
type Qualifier ¶
type Qualifier string
Qualifier represents an SPF mechanism qualifier (e.g., "+", "-", "~", "?").
type Record ¶
type Record struct {
Version string `mapstructure:"version"`
Mechanisms []Mechanism `mapstructure:"mechanisms"`
All bool `mapstructure:"all"`
AllQualifier Qualifier `mapstructure:"all-qualifier"`
}
Record represents an SPF DNS record.
func (*Record) RecordPrefix ¶
RecordPrefix returns the DNS owner label prefix for an SPF record: always "" (the apex).
func (*Record) RecordType ¶
RecordType returns the DNS record type string, "TXT".
func (*Record) RecordValue ¶
RecordValue returns the wire-ready, quoted SPF record value.