dmarc

package
v0.783.0 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2026 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package dmarc decodes a DMARC policy DNS record (the `_dmarc.<domain>` TXT record, RFC 7489 §6.3) into a structured, forensic view.

DMARC is the enforcement policy that ties SPF and DKIM together and tells receivers what to do with mail that fails alignment — so it is the single best read on a domain's anti-spoofing posture. The headline finding is objective and falls straight out of the record: `p=none` means the domain is monitoring only and **does not block spoofed mail**, and `pct<100` means only part of failing mail is filtered. This decoder surfaces the requested policy, subdomain policy, sampling percent, alignment modes, and the aggregate / forensic report destinations (themselves useful OSINT).

Wrap-vs-native: native — RFC 7489 tag=value parsing, stdlib only, no new go.mod dependency. The field extraction is pinned against live published records (google.com / paypal.com / github.com) and the RFC tag definitions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Result

type Result struct {
	// Version is the v= tag (must be "DMARC1").
	Version string `json:"version"`
	// Policy is the p= requested policy: none / quarantine / reject.
	Policy string `json:"policy"`
	// SubdomainPolicy is the sp= tag; empty means "inherits p".
	SubdomainPolicy string `json:"subdomain_policy,omitempty"`
	// Pct is the pct= sampling percent (default 100).
	Pct int `json:"pct"`
	// Enforcing is true when the policy actually blocks (quarantine or reject).
	Enforcing bool `json:"enforcing"`
	// AggregateReports is the rua= destination list.
	AggregateReports []string `json:"aggregate_reports,omitempty"`
	// ForensicReports is the ruf= destination list.
	ForensicReports []string `json:"forensic_reports,omitempty"`
	// DKIMAlignment is adkim=: "r" relaxed (default) or "s" strict.
	DKIMAlignment string `json:"dkim_alignment"`
	// SPFAlignment is aspf=: "r" relaxed (default) or "s" strict.
	SPFAlignment string `json:"spf_alignment"`
	// FailureOptions is the fo= failure-reporting option list (default ["0"]).
	FailureOptions []string `json:"failure_options,omitempty"`
	// ReportInterval is ri= aggregate-report interval seconds (default 86400).
	ReportInterval int `json:"report_interval"`
	// Warnings carries objective, RFC-anchored observations.
	Warnings []string `json:"warnings,omitempty"`
	// Note carries interpretation guidance.
	Note string `json:"note,omitempty"`
}

Result is the decoded DMARC record.

func Decode

func Decode(record string) (*Result, error)

Decode parses a DMARC policy TXT record.

Jump to

Keyboard shortcuts

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