dnsauth

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2026 License: MIT Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package dnsauth checks the DNS records that decide whether other mail servers accept your mail: MX, SPF, DKIM, DMARC and PTR/FCrDNS.

Index

Constants

View Source
const (
	OK   = "ok"
	Warn = "warn"
	Fail = "fail"
	Info = "info"
)

Status of one check.

Variables

View Source
var CommonSelectors = []string{"default", "mail", "dkim", "s1", "s2", "selector1", "selector2", "google", "k1", "smtp", "postfix", "key1", "sig1"}

CommonSelectors are probed when no selector is known.

Functions

This section is empty.

Types

type Check

type Check struct {
	Name    string `json:"check"`
	Status  string `json:"status"`
	Record  string `json:"record,omitempty"`
	Message string `json:"message"`
}

Check is one finding.

type Options

type Options struct {
	Domain    string
	IPs       []string // sending IPs to check SPF authorisation and PTR for
	HELO      string   // myhostname, compared against PTR
	Selectors []string // DKIM selectors; if empty, CommonSelectors are probed
}

Options for Run.

type Report

type Report struct {
	Domain string   `json:"domain"`
	IPs    []string `json:"sending_ips,omitempty"`
	Checks []Check  `json:"checks"`
}

Report is the result for one domain.

func Run

func Run(ctx context.Context, res Resolver, o Options) Report

Run performs all checks.

func (Report) Worst

func (r Report) Worst() string

Worst returns the most severe status in the report.

type Resolver

type Resolver interface {
	LookupTXT(ctx context.Context, name string) ([]string, error)
	LookupMX(ctx context.Context, name string) ([]*net.MX, error)
	LookupAddr(ctx context.Context, addr string) ([]string, error)
	LookupIP(ctx context.Context, network, host string) ([]net.IP, error)
}

Resolver is the subset of *net.Resolver used here (mockable in tests).

func NewResolver

func NewResolver(server string) Resolver

NewResolver returns the system resolver, or one that queries server ("1.1.1.1" or "1.1.1.1:53") directly.

Jump to

Keyboard shortcuts

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