diff options
| author | Christian Cleberg <[email protected]> | 2026-04-20 15:28:12 -0500 |
|---|---|---|
| committer | Christian Cleberg <[email protected]> | 2026-04-20 15:28:12 -0500 |
| commit | ee2520f2c0c2d806fd284c3d6b8a81a3822f5270 (patch) | |
| tree | 0680550a1071e01546ba074c2f20b1bf5a452238 /DomainDig/EmailSecurityService.swift | |
| parent | 4e94ee723cd19c964b1cf37792931e0c7c4614f4 (diff) | |
| download | domain-dig-ee2520f2c0c2d806fd284c3d6b8a81a3822f5270.tar.gz domain-dig-ee2520f2c0c2d806fd284c3d6b8a81a3822f5270.tar.bz2 domain-dig-ee2520f2c0c2d806fd284c3d6b8a81a3822f5270.zip | |
feat(v1.8): improve result structure, history, and consistency
- normalize sections and add summary card
- fix resolver usage in reverse DNS
- include custom port scans in history/export
- standardize error handling
- decompose ContentView into smaller views
Diffstat (limited to 'DomainDig/EmailSecurityService.swift')
| -rw-r--r-- | DomainDig/EmailSecurityService.swift | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/DomainDig/EmailSecurityService.swift b/DomainDig/EmailSecurityService.swift index 50e5f73..c80d0f7 100644 --- a/DomainDig/EmailSecurityService.swift +++ b/DomainDig/EmailSecurityService.swift @@ -8,7 +8,7 @@ struct EmailSecurityService { /// Analyze email security records. SPF is parsed from existing TXT records; /// DMARC and DKIM require additional DoH queries. - static func analyze(domain: String, txtRecords: [DNSRecord]) async -> EmailSecurityResult { + static func analyze(domain: String, txtRecords: [DNSRecord]) async -> ServiceResult<EmailSecurityResult> { // SPF: prefer the already-fetched apex TXT records, but fall back to a direct lookup // in case the earlier DNS section missed or normalized the record differently. let localSPFRecord = txtRecords.first(where: { isMatchingTXTRecord($0.value, prefix: "v=spf1") })?.value @@ -49,13 +49,16 @@ struct EmailSecurityService { value: bimiValue ) - return EmailSecurityResult( + let result = EmailSecurityResult( spf: spf, dmarc: dmarc, dkim: dkim, bimi: bimi, mtaSts: mtaSts ) + + let hasAnyRecord = result.spf.found || result.dmarc.found || result.dkim.found || result.bimi.found || result.mtaSts?.txtFound == true + return hasAnyRecord ? .success(result) : .empty("No email security records found") } /// Query a TXT record for the given subdomain via DoH. |
