dmarc

package
v1.0.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 3, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoRecordFound   = errors.New("no record found")
	ErrDNSLookupFailed = errors.New("dns lookup failed")
)

Functions

This section is empty.

Types

type AlignmentMode

type AlignmentMode string
const (
	AlignmentRelaxed AlignmentMode = "r" // relaxed
	AlignmentStrict  AlignmentMode = "s" // strict
)

type FailureOption

type FailureOption string
const (
	FailureAllFail  FailureOption = "0" // Report when all mechanisms fail with no aligned pass
	FailureAnyFail  FailureOption = "1" // Report when any mechanism fails to produce aligned pass
	FailureDKIMOnly FailureOption = "d" // Report when a DKIM signature fails evaluation
	FailureSPFOnly  FailureOption = "s" // Report when SPF evaluation fails
)

type PolicyType

type PolicyType string
const (
	PolicyNone       PolicyType = "none"
	PolicyQuarantine PolicyType = "quarantine"
	PolicyReject     PolicyType = "reject"
)

type Record added in v1.0.2

type Record struct {
	AggregateReportURI []ReportURI     // rua Aggregate report URIs
	AlignmentDKIM      AlignmentMode   // adkim DKIM alignment mode (r or s)
	AlignmentSPF       AlignmentMode   // aspf SPF alignment mode (r or s)
	ForensicReportURI  []ReportURI     // ruf Forensic report URIs (optional, deprecated)
	FailureOptions     []FailureOption // fo Forensic reporting options (optional, deprecated)
	Percent            int             // pct Percentage of messages to apply policy to
	Policy             PolicyType      // p Policy (none, quarantine, reject)
	ReportFormat       []ReportFormat  // rf Format for message-specific failure reports
	ReportInterval     uint32          // ri Interval for aggregate reports (seconds)
	SubdomainPolicy    PolicyType      // sp Subdomain policy
	Version            string          // v DMARC version, must be "DMARC1"
	// contains filtered or unexported fields
}

func LookupRecord added in v1.0.2

func LookupRecord(domain string) (*Record, error)

func LookupRecordWithSubdomainFallback added in v1.0.2

func LookupRecordWithSubdomainFallback(domain string) (*Record, error)

func ParseRecord added in v1.0.2

func ParseRecord(raw string) (*Record, error)

type ReportFormat added in v1.0.8

type ReportFormat string

ReportFormat represents the format requested for message-specific failure reports. Per RFC 7489 Section 6.3.8, only "afrf" is currently supported.

const (
	ReportFormatAFRF ReportFormat = "afrf" // Authentication Failure Reporting Format
)

type ReportURI added in v1.0.8

type ReportURI struct {
	URI     string // The report URI
	MaxSize int64  // Maximum size in bytes (0 means no limit)
}

ReportURI represents a DMARC URI with an optional size limit. Example: "mailto:reports@example.com!50m" (50 megabytes max) Per RFC 7489 Section 6.2 and 6.4.

type TXTLookupFunc

type TXTLookupFunc func(name string) ([]string, error)
var DefaultResolver TXTLookupFunc = net.LookupTXT

DefaultResolver is the default TXT lookup function.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL