Documentation
¶
Overview ¶
Package doctor ties the queue, log, config and DNS checks together. Both the CLI and the MCP server call into it.
Index ¶
- Constants
- func ConfigView(all map[string]string) map[string]string
- func WriteDNS(w io.Writer, s Style, r dnsauth.Report)
- func WriteLog(w io.Writer, s Style, lr LogResult)
- func WriteQueue(w io.Writer, s Style, q queue.Summary)
- func WriteReport(w io.Writer, s Style, r Report)
- func WriteShape(w io.Writer, s Style, sh queue.Shape)
- func WriteTrend(w io.Writer, s Style, tr TrendResult)
- type DNSOptions
- type Env
- func (e *Env) Config(ctx context.Context) (map[string]string, error)
- func (e *Env) DNS(ctx context.Context, o DNSOptions) (dnsauth.Report, error)
- func (e *Env) Identity(ctx context.Context) SenderIdentity
- func (e *Env) LogStats(ctx context.Context, window time.Duration, domain string, top int) (LogResult, error)
- func (e *Env) LogTrend(ctx context.Context, window, bucketSize time.Duration, domain string, top int) (TrendResult, error)
- func (e *Env) Queue(ctx context.Context) ([]queue.Message, error)
- func (e *Env) Run(ctx context.Context, o Options) Report
- func (e *Env) Trace(ctx context.Context, query string, window time.Duration, limit int) ([]maillog.TracedMessage, string, error)
- type Finding
- type LogResult
- type Options
- type Report
- type SenderIdentity
- type Style
- type TrendResult
Constants ¶
const ( SevProblem = "problem" SevWarn = "warning" SevInfo = "info" )
Severity of a finding.
Variables ¶
This section is empty.
Functions ¶
func ConfigView ¶
ConfigView returns the subset of postconf -n that matters for delivery.
func WriteQueue ¶
WriteQueue prints a queue summary.
func WriteReport ¶
WriteReport prints the doctor report.
func WriteShape ¶
WriteShape prints a qshape matrix.
func WriteTrend ¶ added in v0.2.0
func WriteTrend(w io.Writer, s Style, tr TrendResult)
WriteTrend prints per-destination deferral trends.
Types ¶
type DNSOptions ¶
type DNSOptions struct {
Domain string
IPs []string
Selectors []string
HELO string
// SelectorsFromLog: if no selectors are given, look for opendkim signing lines in the log.
SelectorsFromLog bool
}
DNSOptions for DNS.
type Env ¶
type Env struct {
Runner postfix.Runner
Logs postfix.LogSource
QueueFile string // read postqueue -j output from this file instead of running postqueue
Resolver dnsauth.Resolver
Now func() time.Time
}
Env is the shared runtime configuration.
func (*Env) Identity ¶
func (e *Env) Identity(ctx context.Context) SenderIdentity
Identity derives the sending domain/IPs from postconf (best effort).
func (*Env) LogStats ¶
func (e *Env) LogStats(ctx context.Context, window time.Duration, domain string, top int) (LogResult, error)
LogStats aggregates the log since now-window.
func (*Env) LogTrend ¶ added in v0.2.0
func (e *Env) LogTrend(ctx context.Context, window, bucketSize time.Duration, domain string, top int) (TrendResult, error)
LogTrend aggregates per-destination deferral rates over time buckets. bucketSize 0 selects an automatic width from the window.
type Finding ¶
type Finding struct {
Severity string `json:"severity"`
Area string `json:"area"` // queue, log, dns, config
Title string `json:"title"`
Detail string `json:"detail,omitempty"`
Next string `json:"next_step,omitempty"`
}
Finding is one thing the operator should know.
type LogResult ¶
type LogResult struct {
Source string `json:"source"`
Since time.Time `json:"since"`
Stats maillog.Stats `json:"stats"`
}
LogResult is log statistics plus where they came from.
type Options ¶
type Options struct {
Window time.Duration
Domain string
IPs []string
Selectors []string
SkipDNS bool
SkipLog bool
Top int
}
Options for Run.
type Report ¶
type Report struct {
GeneratedAt time.Time `json:"generated_at"`
Identity SenderIdentity `json:"identity"`
Queue *queue.Summary `json:"queue,omitempty"`
QueueError string `json:"queue_error,omitempty"`
Shape *queue.Shape `json:"shape,omitempty"`
Log *LogResult `json:"log,omitempty"`
LogError string `json:"log_error,omitempty"`
Trend *TrendResult `json:"trend,omitempty"`
DNS *dnsauth.Report `json:"dns,omitempty"`
DNSError string `json:"dns_error,omitempty"`
Config map[string]string `json:"config,omitempty"`
Findings []Finding `json:"findings"`
Problems int `json:"problems"`
Warnings int `json:"warnings"`
}
Report is the combined diagnosis.
type SenderIdentity ¶
type SenderIdentity struct {
Hostname string `json:"myhostname"`
Domain string `json:"sending_domain"`
IPs []string `json:"sending_ips"`
}
SenderIdentity is what Postfix presents to the world, from postconf.