MCPcopy Create free account
hub / github.com/foxcpp/maddy / FetchRecord

Method FetchRecord

internal/dmarc/verifier.go:84–113  ·  view source on GitHub ↗

FetchRecord prepares the Verifier by starting the policy lookup. Lookup is performed asynchronously to improve performance. If panic occurs in the lookup goroutine - call to Apply will panic.

(ctx context.Context, header textproto.Header)

Source from the content-addressed store, hash-verified

82//
83// If panic occurs in the lookup goroutine - call to Apply will panic.
84func (v *Verifier) FetchRecord(ctx context.Context, header textproto.Header) {
85 fromDomain, err := ExtractFromDomain(header)
86 if err != nil {
87 v.fetchCh <- verifyData{
88 recordErr: err,
89 }
90 return
91 }
92
93 ctx, v.fetchCancel = context.WithCancel(ctx)
94 go func() {
95 defer func() {
96 if err := recover(); err != nil {
97 v.fetchCh <- verifyData{
98 recordErr: errPanic{err: err},
99 }
100 }
101 }()
102
103 defer trace.StartRegion(ctx, "DMARC/FetchRecord").End()
104
105 policyDomain, record, err := FetchRecord(ctx, v.resolver, fromDomain)
106 v.fetchCh <- verifyData{
107 policyDomain: policyDomain,
108 fromDomain: fromDomain,
109 record: record,
110 recordErr: err,
111 }
112 }()
113}
114
115// Apply actually performs all actions necessary to apply a DMARC policy to the message.
116//

Callers 3

TestDMARCFunction · 0.95
checkBodyMethod · 0.80
relyOnDMARCMethod · 0.80

Calls 2

ExtractFromDomainFunction · 0.85
FetchRecordFunction · 0.85

Tested by 1

TestDMARCFunction · 0.76