parser

package
v1.4.5 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthResults

type AuthResults struct {
	DKIM []DKIMResult `xml:"dkim,omitempty"`
	SPF  []SPFResult  `xml:"spf"`
}

AuthResults contains authentication results

type DKIMResult

type DKIMResult struct {
	Domain      string `xml:"domain"`
	Selector    string `xml:"selector,omitempty"`
	Result      string `xml:"result"` // none, pass, fail, policy, neutral, temperror, permerror
	HumanResult string `xml:"human_result,omitempty"`
}

DKIMResult represents DKIM authentication result

type DateRange

type DateRange struct {
	Begin int64 `xml:"begin"`
	End   int64 `xml:"end"`
}

DateRange specifies the time range for the report

type Feedback

type Feedback struct {
	XMLName         xml.Name        `xml:"feedback"`
	Version         string          `xml:"version"`
	ReportMetadata  ReportMetadata  `xml:"report_metadata"`
	PolicyPublished PolicyPublished `xml:"policy_published"`
	Records         []Record        `xml:"record"`
}

Feedback represents the root DMARC aggregate report structure (RFC 7489)

func ParseReport

func ParseReport(data []byte) (*Feedback, error)

ParseReport parses a DMARC aggregate report from raw data

func (*Feedback) GetDMARCCompliantCount

func (f *Feedback) GetDMARCCompliantCount() int

GetDMARCCompliantCount returns count of DMARC-compliant messages

func (*Feedback) GetDateRange

func (f *Feedback) GetDateRange() (time.Time, time.Time)

GetDateRange returns the date range as time.Time objects

func (*Feedback) GetTotalMessages

func (f *Feedback) GetTotalMessages() int

GetTotalMessages returns the total count of messages in the report

type Identifiers

type Identifiers struct {
	EnvelopeTo   string `xml:"envelope_to,omitempty"`
	EnvelopeFrom string `xml:"envelope_from,omitempty"`
	HeaderFrom   string `xml:"header_from"`
}

Identifiers contains message identifiers

type PolicyEvaluated

type PolicyEvaluated struct {
	Disposition string   `xml:"disposition"` // none, quarantine, reject
	DKIM        string   `xml:"dkim"`        // pass, fail
	SPF         string   `xml:"spf"`         // pass, fail
	Reason      []Reason `xml:"reason,omitempty"`
}

PolicyEvaluated shows the result of policy evaluation

type PolicyPublished

type PolicyPublished struct {
	Domain string `xml:"domain"`
	ADKIM  string `xml:"adkim,omitempty"` // DKIM alignment mode (r=relaxed, s=strict)
	ASPF   string `xml:"aspf,omitempty"`  // SPF alignment mode (r=relaxed, s=strict)
	P      string `xml:"p"`               // Policy (none, quarantine, reject)
	SP     string `xml:"sp,omitempty"`    // Subdomain policy
	PCT    int    `xml:"pct,omitempty"`   // Percentage of messages to filter
	FO     string `xml:"fo,omitempty"`    // Failure reporting options
}

PolicyPublished represents the DMARC policy as published in DNS

type Reason

type Reason struct {
	Type    string `xml:"type"`
	Comment string `xml:"comment,omitempty"`
}

Reason explains policy override

type Record

type Record struct {
	Row         Row         `xml:"row"`
	Identifiers Identifiers `xml:"identifiers"`
	AuthResults AuthResults `xml:"auth_results"`
}

Record represents a single record in the aggregate report

type ReportMetadata

type ReportMetadata struct {
	OrgName          string    `xml:"org_name"`
	Email            string    `xml:"email"`
	ExtraContactInfo string    `xml:"extra_contact_info,omitempty"`
	ReportID         string    `xml:"report_id"`
	DateRange        DateRange `xml:"date_range"`
	Errors           []string  `xml:"error,omitempty"`
}

ReportMetadata contains information about the report

type Row

type Row struct {
	SourceIP        string          `xml:"source_ip"`
	Count           int             `xml:"count"`
	PolicyEvaluated PolicyEvaluated `xml:"policy_evaluated"`
}

Row contains policy evaluation results

type SPFResult

type SPFResult struct {
	Domain string `xml:"domain"`
	Scope  string `xml:"scope,omitempty"` // helo, mfrom
	Result string `xml:"result"`          // none, neutral, pass, fail, softfail, temperror, permerror
}

SPFResult represents SPF authentication result

Jump to

Keyboard shortcuts

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