Documentation
¶
Overview ¶
Package deliverability builds the Deliverability screen (spec 7.8): health per sending domain and dedicated IP (shared pools are checked at domain level), provider account health against each provider's own thresholds, blocklists (via HostRepute when connected, else a built-in DNSBL set), Postmaster Tools, SNDS, DMARC reports and the incident timeline. It also runs the local checks, gives Send Readiness its reputation verdict and records incidents for other domains.
Index ¶
- Constants
- func ParseReport(data []byte) (hostrepute.DMARCReport, error)
- func RecordIncident(ctx context.Context, q *store.Queries, workspaceID uuid.UUID, in Incident) error
- func Register(h huma.API, s *Service)
- func Requirements(raw json.RawMessage) []dnscheck.Requirement
- type CheckArgs
- type CheckWorker
- type DeliverabilityAssetBlocklists
- type DeliverabilityAssetHealth
- type DeliverabilityBlocklistSource
- type DeliverabilityBlocklistStatus
- type DeliverabilityCheckRun
- type DeliverabilityChecks
- type DeliverabilityDMARCSource
- type DeliverabilityDMARCSourceDetail
- type DeliverabilityDMARCSummary
- type DeliverabilityDMARCUpload
- type DeliverabilityDelistingOutcome
- type DeliverabilityDelistingRequest
- type DeliverabilityDomainAuth
- type DeliverabilityHostRepute
- type DeliverabilityIncident
- type DeliverabilityIncidentLink
- type DeliverabilityIncidentTimeline
- type DeliverabilityOverview
- type DeliverabilityPoolHealth
- type DeliverabilityPostmaster
- type DeliverabilityPostmasterPeak
- type DeliverabilityPostmasterPoint
- type DeliverabilityProviderHealth
- type DeliverabilityProviderNote
- type DeliverabilityRateLimit
- type DeliverabilityReputation
- type DeliverabilityReputationListing
- type DeliverabilityReverseDNS
- type DeliverabilitySNDS
- type DeliverabilitySNDSBrief
- type DeliverabilityWarmupProgress
- type HostReputeOutage
- type Incident
- type ScheduleArgs
- type ScheduleWorker
- type Service
- func (s *Service) AssetStatuses(ctx context.Context, ws uuid.UUID) (map[string]hostrepute.AssetStatus, error)
- func (s *Service) DMARCSource(ctx context.Context, ws *store.Workspace, ip string) (DeliverabilityDMARCSourceDetail, error)
- func (s *Service) Export(ctx context.Context, ws *store.Workspace) ([]byte, error)
- func (s *Service) Fallback(ctx context.Context, tx pgx.Tx, ws uuid.UUID, trigger string) error
- func (s *Service) Overview(ctx context.Context, ws *store.Workspace) (DeliverabilityOverview, error)
- func (s *Service) Reputation(ctx context.Context, ws *store.Workspace) (DeliverabilityReputation, error)
- func (s *Service) RequestDelisting(ctx context.Context, ws *store.Workspace, asset, source string) (DeliverabilityDelistingRequest, error)
- func (s *Service) Run(ctx context.Context, ws uuid.UUID, id uuid.UUID) (DeliverabilityCheckRun, error)
- func (s *Service) RunChecks(ctx context.Context, args CheckArgs) error
- func (s *Service) RunNow(ctx context.Context, ws *store.Workspace, builtinOnly bool) (DeliverabilityCheckRun, error)
- func (s *Service) UploadReport(ctx context.Context, ws *store.Workspace, data []byte) (DeliverabilityDMARCUpload, error)
Constants ¶
const ( KindAutoPause = "auto_pause" KindWarmupSlowdown = "warmup_slowdown" KindWebhooksSilent = "webhooks_silent" KindProviderOutage = "provider_outage" KindBlocklistListed = "blocklist_listed" KindMigration = "migration" )
Incident kinds other domains record (see RecordIncident).
const MaxReportBytes = 20 << 20
MaxReportBytes caps an uploaded report, compressed and decompressed.
Variables ¶
This section is empty.
Functions ¶
func ParseReport ¶
func ParseReport(data []byte) (hostrepute.DMARCReport, error)
ParseReport reads an aggregate report: XML, gzip'd XML or a zip with one XML file, as mailbox providers send them.
func RecordIncident ¶
func RecordIncident(ctx context.Context, q *store.Queries, workspaceID uuid.UUID, in Incident) error
RecordIncident adds an incident to the timeline, inside the caller's transaction.
func Requirements ¶
func Requirements(raw json.RawMessage) []dnscheck.Requirement
Requirements reads the provider records stored on a sending domain.
Types ¶
type CheckArgs ¶
type CheckArgs struct {
WorkspaceID uuid.UUID `json:"workspace_id" river:"unique"`
RunID *uuid.UUID `json:"run_id,omitempty" river:"unique"`
Blocklists bool `json:"blocklists" river:"unique"`
}
CheckArgs is the River job of the local checks: DNS authentication of the sending domains, reverse DNS of the dedicated IPs and, when Blocklists is set, the built-in DNSBL check.
func (CheckArgs) InsertOpts ¶
func (CheckArgs) InsertOpts() river.InsertOpts
InsertOpts keeps one pending check per workspace and kind of check.
type CheckWorker ¶
type CheckWorker struct {
river.WorkerDefaults[CheckArgs]
S *Service
}
CheckWorker runs CheckArgs.
type DeliverabilityAssetBlocklists ¶
type DeliverabilityAssetBlocklists struct {
Via string `json:"via" enum:"hostrepute,builtin,none"`
Sources int `json:"sources"`
Listed int `json:"listed"`
Listings []string `json:"listings"`
CheckedAt *time.Time `json:"checkedAt,omitempty"`
// HighImpact is true when one listing is on a high-impact list.
HighImpact bool `json:"highImpact"`
}
DeliverabilityAssetBlocklists summarizes an asset's blocklist checks.
type DeliverabilityAssetHealth ¶
type DeliverabilityAssetHealth struct {
Asset string `json:"asset"`
Type string `json:"type" enum:"domain,ip"`
Role string `json:"role" enum:"sending_domain,dedicated_ip"`
// UsedBy are the providers that send for the domain ("SES", "Postmark").
UsedBy []string `json:"usedBy"`
// Provider sends from the dedicated IP ("Postal").
Provider string `json:"provider,omitempty"`
ProviderID string `json:"providerId,omitempty"`
ProviderStatus string `json:"providerStatus,omitempty"`
Warmup *DeliverabilityWarmupProgress `json:"warmup,omitempty"`
// Score and Verdict come from HostRepute.
Score *int `json:"score,omitempty"`
Verdict string `json:"verdict,omitempty"`
Tone string `json:"tone" enum:"ok,warn,bad,neutral"`
// Blocklists from the current source; Fallback holds the built-in
// results while HostRepute data is stale.
Blocklists DeliverabilityAssetBlocklists `json:"blocklists"`
Fallback *DeliverabilityAssetBlocklists `json:"fallback,omitempty"`
// Stale is when the HostRepute data on the card was last fresh.
Stale *time.Time `json:"stale,omitempty"`
// Auth is the SPF / DKIM / DMARC check of a domain.
Auth *DeliverabilityDomainAuth `json:"auth,omitempty"`
// DMARCAligned is the share of DMARC-aligned mail, last 7 days (percent).
DMARCAligned *float64 `json:"dmarcAligned,omitempty"`
ReverseDNS *DeliverabilityReverseDNS `json:"reverseDns,omitempty"`
SNDS *DeliverabilitySNDSBrief `json:"snds,omitempty"`
// NotMonitored: HostRepute is connected but doesn't watch this asset
// yet (a new sending domain, such as a Transactional one). The card
// offers "Add to monitoring"; such cards come after the monitored ones.
NotMonitored bool `json:"notMonitored,omitempty"`
}
DeliverabilityAssetHealth is one sending domain or dedicated IP.
type DeliverabilityBlocklistSource ¶
type DeliverabilityBlocklistSource struct {
Source string `json:"source"`
Impact string `json:"impact" enum:"high,medium,low"`
Assets []string `json:"assets"`
Listed bool `json:"listed"`
ListedAssets []string `json:"listedAssets"`
Since *time.Time `json:"since,omitempty"`
DelistURL string `json:"delistUrl,omitempty"`
Detail string `json:"detail,omitempty"`
Delisting string `json:"delisting,omitempty" enum:"requested,pending,delisted,denied"`
DelistingAt *time.Time `json:"delistingAt,omitempty"`
}
DeliverabilityBlocklistSource is one source and the assets checked on it.
type DeliverabilityBlocklistStatus ¶
type DeliverabilityBlocklistStatus struct {
Via string `json:"via" enum:"hostrepute,builtin,none"`
Sources int `json:"sources"`
Interval string `json:"interval" enum:"hourly,daily"`
Assets []string `json:"assets"`
Clean int `json:"clean"`
Listed int `json:"listed"`
CheckedAt *time.Time `json:"checkedAt,omitempty"`
// Stale is true while HostRepute data can't be refreshed.
Stale bool `json:"stale"`
Results []DeliverabilityBlocklistSource `json:"results"`
}
DeliverabilityBlocklistStatus is the blacklist table.
type DeliverabilityCheckRun ¶
type DeliverabilityCheckRun struct {
ID string `json:"id"`
Via string `json:"via" enum:"hostrepute,builtin"`
Trigger string `json:"trigger" enum:"schedule,manual,connect,fallback"`
Status string `json:"status" enum:"running,done,failed"`
Assets []string `json:"assets"`
Total int32 `json:"total"`
Answered int32 `json:"answered"`
Listed int32 `json:"listed"`
Error string `json:"error,omitempty"`
StartedAt time.Time `json:"startedAt"`
FinishedAt *time.Time `json:"finishedAt,omitempty"`
}
DeliverabilityCheckRun is one run of the checks.
type DeliverabilityChecks ¶
type DeliverabilityChecks struct {
Via string `json:"via" enum:"hostrepute,builtin"`
Interval string `json:"interval" enum:"hourly,daily"`
LastAt *time.Time `json:"lastAt,omitempty"`
NextAt *time.Time `json:"nextAt,omitempty"`
// Running is the check in progress ("61 of 84 sources answered").
Running *DeliverabilityCheckRun `json:"running,omitempty"`
// BuiltinSources is the size of the built-in DNSBL set (8).
BuiltinSources int `json:"builtinSources"`
}
DeliverabilityChecks says how and when the checks run.
type DeliverabilityDMARCSource ¶
type DeliverabilityDMARCSource struct {
Label string `json:"label" doc:"Amazon SES, Postal · 203.0.113.25, Unknown · 198.51.100.77"`
ProviderID string `json:"providerId,omitempty"`
Adapter string `json:"adapter,omitempty"`
IP string `json:"ip,omitempty"`
Known bool `json:"known"`
Messages int64 `json:"messages"`
SPF string `json:"spf" doc:"aligned, or the raw result: fail, softfail, none…"`
DKIM string `json:"dkim"`
Result string `json:"result" enum:"pass,quarantined,rejected,fail"`
}
DeliverabilityDMARCSource is one sending source in the reports.
type DeliverabilityDMARCSourceDetail ¶
type DeliverabilityDMARCSourceDetail struct {
IP string `json:"ip"`
PTR string `json:"ptr,omitempty"`
Known bool `json:"known"`
Provider string `json:"provider,omitempty"`
Messages int64 `json:"messages"`
Reports int `json:"reports"`
Reporters []string `json:"reporters"`
HeaderFrom []string `json:"headerFrom"`
SPFDomains []string `json:"spfDomains"`
DKIMDomains []string `json:"dkimDomains"`
SPF string `json:"spf"`
DKIM string `json:"dkim"`
Disposition string `json:"disposition"`
// Policy is the published DMARC policy that applied (quarantine).
Policy string `json:"policy,omitempty"`
FirstSeen time.Time `json:"firstSeen"`
LastSeen time.Time `json:"lastSeen"`
}
DeliverabilityDMARCSourceDetail is "Investigate source": everything the reports say about one sending IP.
type DeliverabilityDMARCSummary ¶
type DeliverabilityDMARCSummary struct {
Via string `json:"via" enum:"hostrepute,upload,none"`
Days int `json:"days"`
Rua string `json:"rua,omitempty"`
Domain string `json:"domain,omitempty"`
Policy string `json:"policy,omitempty"`
Reports int `json:"reports"`
Messages int64 `json:"messages"`
// PassRate is the share of messages that passed DMARC (percent).
PassRate *float64 `json:"passRate,omitempty"`
Sources []DeliverabilityDMARCSource `json:"sources"`
// Unknown is the largest source that isn't one of the providers.
Unknown *DeliverabilityDMARCSource `json:"unknown,omitempty"`
}
DeliverabilityDMARCSummary is the DMARC aggregate report summary, last 7 days.
type DeliverabilityDMARCUpload ¶
type DeliverabilityDMARCUpload struct {
OrgName string `json:"orgName"`
ReportID string `json:"reportId"`
Domain string `json:"domain"`
Messages int64 `json:"messages"`
Records int `json:"records"`
From time.Time `json:"from"`
To time.Time `json:"to"`
}
DeliverabilityDMARCUpload is the result of uploading a report.
type DeliverabilityDelistingOutcome ¶
type DeliverabilityDelistingOutcome struct {
Source string `json:"source"`
Status string `json:"status" enum:"requested,pending,delisted,denied"`
RequestedAt time.Time `json:"requestedAt"`
// Already is true when a request was already pending.
Already bool `json:"already"`
URL string `json:"url,omitempty"`
}
DeliverabilityDelistingOutcome is one source's delisting request.
type DeliverabilityDelistingRequest ¶
type DeliverabilityDelistingRequest struct {
Asset string `json:"asset"`
Requests []DeliverabilityDelistingOutcome `json:"requests"`
}
DeliverabilityDelistingRequest is the result of "Request delisting".
type DeliverabilityDomainAuth ¶
type DeliverabilityDomainAuth struct {
SPF string `json:"spf"`
DKIM string `json:"dkim"`
DMARC string `json:"dmarc" doc:"Policy (none, quarantine, reject) or missing / invalid"`
BIMI string `json:"bimi"`
ReturnPath string `json:"returnPath"`
CheckedAt *time.Time `json:"checkedAt,omitempty"`
}
DeliverabilityDomainAuth is "pass · pass · p=quarantine".
type DeliverabilityHostRepute ¶
type DeliverabilityHostRepute struct {
Status string `json:"status" enum:"not_connected,connected,revoked,expired,error"`
TeamName string `json:"teamName,omitempty"`
// Sources is how many blocklists HostRepute checks (84).
Sources int32 `json:"sources"`
IntervalMinutes int32 `json:"intervalMinutes"`
LastSyncAt *time.Time `json:"lastSyncAt,omitempty"`
TokenRejectedAt *time.Time `json:"tokenRejectedAt,omitempty"`
// Unreachable is set while HostRepute can't be reached; HostRepute data
// on the page is from LastSyncAt.
Unreachable *HostReputeOutage `json:"unreachable,omitempty"`
DMARCRua string `json:"dmarcRua,omitempty"`
}
DeliverabilityHostRepute is the HostRepute part of the screen header.
type DeliverabilityIncident ¶
type DeliverabilityIncident struct {
ID string `json:"id"`
OccurredAt time.Time `json:"occurredAt"`
Kind string `json:"kind"`
Severity string `json:"severity" enum:"info,ok,warn,bad"`
Title string `json:"title"`
Detail string `json:"detail"`
Source string `json:"source" enum:"reputecast,hostrepute,builtin"`
Links []DeliverabilityIncidentLink `json:"links"`
}
DeliverabilityIncident is one incident, linked to campaigns and providers.
type DeliverabilityIncidentLink ¶
type DeliverabilityIncidentLink struct {
Kind string `json:"kind" enum:"warmup,campaign,campaign_report,provider,provider_events,import,deliverability"`
Label string `json:"label"`
ID string `json:"id,omitempty"`
}
DeliverabilityIncidentLink points to the screen an incident is about.
type DeliverabilityIncidentTimeline ¶
type DeliverabilityIncidentTimeline struct {
Items []DeliverabilityIncident `json:"items"`
Total int64 `json:"total"`
// FromHostRepute is true when HostRepute alerts are part of the timeline.
FromHostRepute bool `json:"fromHostRepute"`
}
type DeliverabilityOverview ¶
type DeliverabilityOverview struct {
HostRepute DeliverabilityHostRepute `json:"hostRepute"`
Checks DeliverabilityChecks `json:"checks"`
Assets []DeliverabilityAssetHealth `json:"assets"`
Pools []DeliverabilityPoolHealth `json:"pools"`
Providers []DeliverabilityProviderHealth `json:"providers"`
Blocklists DeliverabilityBlocklistStatus `json:"blocklists"`
Postmaster *DeliverabilityPostmaster `json:"postmaster,omitempty"`
SNDS *DeliverabilitySNDS `json:"snds,omitempty"`
DMARC DeliverabilityDMARCSummary `json:"dmarc"`
Incidents DeliverabilityIncidentTimeline `json:"incidents"`
}
DeliverabilityOverview is the Deliverability screen (spec 7.8).
type DeliverabilityPoolHealth ¶
type DeliverabilityPoolHealth struct {
ProviderID string `json:"providerId"`
Provider string `json:"provider"`
Short string `json:"short"`
Adapter string `json:"adapter"`
Region string `json:"region,omitempty"`
// OnlyStream is set when the provider is primary for one stream only.
OnlyStream string `json:"onlyStream,omitempty" enum:"broadcast,automation,system"`
AccountStatus string `json:"accountStatus"`
Status string `json:"status"`
DedicatedIPOption string `json:"dedicatedIpOption,omitempty"`
VolumeThisMonth *int64 `json:"volumeThisMonth,omitempty"`
// ManagedReputation is true when the provider manages pool reputation (SES).
ManagedReputation bool `json:"managedReputation"`
// Current figures for the error state ("Bounce · complaint").
BounceRate *float64 `json:"bounceRate,omitempty"`
ComplaintRate *float64 `json:"complaintRate,omitempty"`
}
DeliverabilityPoolHealth is a provider's shared IP pool, checked at domain level.
type DeliverabilityPostmaster ¶
type DeliverabilityPostmaster struct {
Domain string `json:"domain"`
Via string `json:"via" enum:"hostrepute,direct"`
Stale bool `json:"stale"`
// Rates in percent. SpamRate is the 30-day average.
SpamRate *float64 `json:"spamRate,omitempty"`
SPF *float64 `json:"spf,omitempty"`
DKIM *float64 `json:"dkim,omitempty"`
DMARC *float64 `json:"dmarc,omitempty"`
TLS *float64 `json:"tls,omitempty"`
// FeedbackLoopFlagged is the number of flagged FBL identifiers (nil: no FBL data).
FeedbackLoopFlagged *int `json:"feedbackLoopFlagged,omitempty"`
// Series is the spam rate in two-day buckets, oldest first.
Series []DeliverabilityPostmasterPoint `json:"series"`
Peak *DeliverabilityPostmasterPeak `json:"peak,omitempty"`
// From and To are dates (YYYY-MM-DD) in the workspace's timezone.
From string `json:"from" format:"date"`
To string `json:"to" format:"date"`
}
DeliverabilityPostmaster is Google Postmaster Tools for the main sending domain.
type DeliverabilityPostmasterPeak ¶
type DeliverabilityPostmasterPeak struct {
Day string `json:"day" format:"date"`
SpamRate float64 `json:"spamRate"`
// Note explains the peak from the timeline ("first send after migration").
Note string `json:"note,omitempty"`
}
DeliverabilityPostmasterPeak is the highest daily spam rate of the period.
type DeliverabilityPostmasterPoint ¶
type DeliverabilityPostmasterPoint struct {
From string `json:"from" format:"date"`
To string `json:"to" format:"date"`
SpamRate *float64 `json:"spamRate,omitempty"`
}
DeliverabilityPostmasterPoint is the average spam rate of a bucket of days.
type DeliverabilityProviderHealth ¶
type DeliverabilityProviderHealth struct {
ProviderID string `json:"providerId"`
Name string `json:"name" doc:"Postal (self-hosted)"`
Adapter string `json:"adapter"`
Status string `json:"status"`
Badge string `json:"badge" doc:"Healthy · no enforcement"`
Tone string `json:"tone" enum:"ok,warn,bad,info,neutral"`
Bounce DeliverabilityRateLimit `json:"bounce"`
Complaint DeliverabilityRateLimit `json:"complaint"`
// NotJudged says why the rates aren't judged against the thresholds yet
// (not enough mail: ReputeCast counted fewer than 500 messages in 7
// days, the rule Send Readiness uses); the rates show, without a tone.
NotJudged string `json:"notJudged,omitempty"`
// Note is one extra fact ("Reputation dashboard", "Stream", "Thresholds").
Note *DeliverabilityProviderNote `json:"note,omitempty"`
}
DeliverabilityProviderHealth is a sending provider's account health against its own thresholds.
type DeliverabilityRateLimit ¶
type DeliverabilityRateLimit struct {
Label string `json:"label" doc:"Bounce rate, Complaint rate, Spam complaint rate"`
// Value is the current rate in percent.
Value *float64 `json:"value,omitempty"`
// Thresholds in words: "review 5%, pause 10%", "limit 10%", "warm-up guard 2%".
Thresholds string `json:"thresholds"`
// Usage is Value as a percent of the first limit (fills the bar).
Usage float64 `json:"usage"`
Tone string `json:"tone" enum:"ok,warn,bad"`
}
DeliverabilityRateLimit is a rate against the provider's limits.
type DeliverabilityReputation ¶
type DeliverabilityReputation struct {
// Status: pass (clean), warn (low or medium impact listing), block
// (high-impact listing) or unknown (no current data: HostRepute rejected
// the token or can't be reached and no fallback ran). Unknown is never
// treated as a Block.
Status string `json:"status" enum:"pass,warn,block,unknown"`
Via string `json:"via" enum:"hostrepute,builtin,none"`
Sources int `json:"sources"`
Listings []DeliverabilityReputationListing `json:"listings"`
CheckedAt *time.Time `json:"checkedAt,omitempty"`
// Reason explains an unknown status: in English for Send Readiness,
// which stores it, and in the reader's language through the API.
Reason string `json:"reason,omitempty"`
// ReasonText is the message Reason comes from, for readers in other
// languages (Send Readiness can keep it beside its English).
ReasonText i18n.Text `json:"-"`
}
DeliverabilityReputation is the "Sender reputation" input of Send Readiness (spec 5.1): blocklist listings of the workspace's domains and IPs.
type DeliverabilityReverseDNS ¶
type DeliverabilityReverseDNS struct {
PTR string `json:"ptr,omitempty"`
Matches bool `json:"matches"`
Status string `json:"status"`
}
DeliverabilityReverseDNS is the forward-confirmed reverse DNS of an IP.
type DeliverabilitySNDS ¶
type DeliverabilitySNDS struct {
IP string `json:"ip"`
Via string `json:"via" enum:"hostrepute,direct"`
Stale bool `json:"stale"`
FilterResult string `json:"filterResult" enum:"green,yellow,red,"`
Messages7d int64 `json:"messages7d"`
// ComplaintRate is the latest rate in percent.
ComplaintRate *float64 `json:"complaintRate,omitempty"`
TrapHits int `json:"trapHits"`
JMRPReports int `json:"jmrpReports"`
}
DeliverabilitySNDS is Microsoft SNDS for the dedicated IP.
type DeliverabilitySNDSBrief ¶
type DeliverabilitySNDSBrief struct {
FilterResult string `json:"filterResult"`
TrapHits int `json:"trapHits"`
}
DeliverabilitySNDSBrief is "Green · 0 trap hits".
type DeliverabilityWarmupProgress ¶
DeliverabilityWarmupProgress is "day 9 of 21".
type HostReputeOutage ¶
type HostReputeOutage struct {
Message string `json:"message" doc:"Couldn't reach api.hostrepute.com (timeout after 30 s, 3 attempts)"`
Since *time.Time `json:"since,omitempty"`
}
HostReputeOutage describes a failing sync.
type Incident ¶
type Incident struct {
Kind string
Severity string // info, ok, warn, bad
Title string
Detail string
// TitleText and DetailText are the messages Title and Detail come from
// (msgs.M(key).Keep(args)): kept in incidents.texts, they read in each
// reader's language. A part given only as a message gets its English.
TitleText i18n.Text
DetailText i18n.Text
// CampaignID and ProviderID link the incident; an incident with a
// provider but no campaign is linked to the campaign that was sending
// through that provider at the time.
CampaignID *uuid.UUID
ProviderID *uuid.UUID
Asset string
OccurredAt time.Time
ResolvedAt *time.Time
}
Incident is an entry of the incident timeline recorded by another domain: the sending engine (auto-pauses), provider health (outages, silent webhooks), the warm-up planner (slowdowns) or the importer (migrations).
type ScheduleArgs ¶
type ScheduleArgs struct{}
ScheduleArgs is the job that queues the daily local checks.
func (ScheduleArgs) InsertOpts ¶
func (ScheduleArgs) InsertOpts() river.InsertOpts
InsertOpts runs the scheduler once per period.
type ScheduleWorker ¶
type ScheduleWorker struct {
river.WorkerDefaults[ScheduleArgs]
S *Service
}
ScheduleWorker queues the checks of workspaces not checked for 20 hours: the built-in blocklist check too when HostRepute isn't covering them.
func (*ScheduleWorker) Work ¶
func (w *ScheduleWorker) Work(ctx context.Context, _ *river.Job[ScheduleArgs]) error
Work implements river.Worker.
type Service ¶
type Service struct {
Pool *pgxpool.Pool
Q *store.Queries
Audit *audit.Logger
Log *slog.Logger
HostRepute *hostrepute.Service
Jobs hostrepute.JobInserter
// DNS answers the local checks; Lists is the built-in DNSBL set.
DNS dnscheck.Resolver
Lists []dnscheck.Blocklist
Now func() time.Time
}
func (*Service) AssetStatuses ¶
func (s *Service) AssetStatuses(ctx context.Context, ws uuid.UUID) (map[string]hostrepute.AssetStatus, error)
AssetStatuses is what Deliverability knows per asset, for Settings › Integrations (it has the signature hostrepute.Service.Status expects).
func (*Service) DMARCSource ¶
func (s *Service) DMARCSource(ctx context.Context, ws *store.Workspace, ip string) (DeliverabilityDMARCSourceDetail, error)
DMARCSource describes one sending IP from the last 7 days of reports.
func (*Service) Export ¶
Export writes the findings as CSV: one row per check, for spreadsheets and tickets. Its rows are data: they stay English in every language.
func (*Service) Fallback ¶
Fallback queues the built-in checks for HostRepute (disconnect, rejected token, outage). It has the signature hostrepute.Service.Fallback expects.
func (*Service) Overview ¶
func (s *Service) Overview(ctx context.Context, ws *store.Workspace) (DeliverabilityOverview, error)
Overview builds the Deliverability screen.
func (*Service) Reputation ¶
func (s *Service) Reputation(ctx context.Context, ws *store.Workspace) (DeliverabilityReputation, error)
Reputation returns the blocklist verdict for Send Readiness.
func (*Service) RequestDelisting ¶
func (s *Service) RequestDelisting(ctx context.Context, ws *store.Workspace, asset, source string) (DeliverabilityDelistingRequest, error)
RequestDelisting asks HostRepute to request delisting of an asset from every list it's on (or one source). Without HostRepute, delisting is done on each list's own page.
func (*Service) Run ¶
func (s *Service) Run(ctx context.Context, ws uuid.UUID, id uuid.UUID) (DeliverabilityCheckRun, error)
Run returns a check run (progress polling).
func (*Service) RunNow ¶
func (s *Service) RunNow(ctx context.Context, ws *store.Workspace, builtinOnly bool) (DeliverabilityCheckRun, error)
RunNow starts "Run all checks now": a HostRepute re-check when HostRepute is connected (plus the local DNS checks), else the built-in checks. A run already in progress, or one started less than a minute ago, is returned instead of starting another.
func (*Service) UploadReport ¶
func (s *Service) UploadReport(ctx context.Context, ws *store.Workspace, data []byte) (DeliverabilityDMARCUpload, error)
UploadReport stores an aggregate report pasted or uploaded by hand.