dmarcdb

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2023 License: MIT Imports: 12 Imported by: 3

Documentation

Overview

Package dmarcdb stores incoming DMARC reports.

With DMARC, a domain can request emails with DMARC verification results by remote mail servers to be sent to a specified address. Mox parses such reports, stores them in its database and makes them available through its admin web interface.

Index

Constants

This section is empty.

Variables

View Source
var (
	DBTypes = []any{DomainFeedback{}} // Types stored in DB.
	DB      *bstore.DB                // Exported for backups.

)

Functions

func AddReport

func AddReport(ctx context.Context, f *dmarcrpt.Feedback, fromDomain dns.Domain) error

AddReport adds a DMARC aggregate feedback report from an email to the database, and updates prometheus metrics.

fromDomain is the domain in the report message From header.

func Init

func Init() error

Init opens the database.

Types

type DomainFeedback

type DomainFeedback struct {
	ID int64
	// Domain where DMARC DNS record was found, could be organizational domain.
	Domain string `bstore:"index"`
	// Domain in From-header.
	FromDomain string `bstore:"index"`
	dmarcrpt.Feedback
}

DomainFeedback is a single report stored in the database.

func RecordID

func RecordID(ctx context.Context, id int64) (DomainFeedback, error)

RecordID returns the report for the ID.

func Records

func Records(ctx context.Context) ([]DomainFeedback, error)

Records returns all reports in the database.

func RecordsPeriodDomain

func RecordsPeriodDomain(ctx context.Context, start, end time.Time, domain string) ([]DomainFeedback, error)

RecordsPeriodDomain returns the reports overlapping start and end, for the given domain. If domain is empty, all records match for domain.

Jump to

Keyboard shortcuts

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