From 376e7b55b4a0c4f54faa0c2828dea4fd17dff288 Mon Sep 17 00:00:00 2001 From: Christian Cleberg Date: Wed, 18 Mar 2026 11:59:38 -0500 Subject: realigning commits --- DomainDig/DNSLookupService.swift | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'DomainDig/DNSLookupService.swift') diff --git a/DomainDig/DNSLookupService.swift b/DomainDig/DNSLookupService.swift index 85a5275..a8f55fd 100644 --- a/DomainDig/DNSLookupService.swift +++ b/DomainDig/DNSLookupService.swift @@ -35,15 +35,16 @@ struct DNSLookupService { } } - /// Record types that support wildcard queries. - private nonisolated(unsafe) static let wildcardTypes: Set = [.A, .AAAA, .MX, .TXT] - static func lookupAll(domain: String) async -> [DNSSection] { // Each task returns (recordType, apex records, wildcard records). typealias Result = (type: DNSRecordType, records: [DNSRecord], wildcard: [DNSRecord], error: String?) + // Record types that support wildcard queries + let wildcardTypes: Set = [.A, .AAAA, .MX, .TXT] + return await withTaskGroup(of: Result.self, returning: [DNSSection].self) { group in for recordType in DNSRecordType.allCases { + let shouldQueryWildcard = wildcardTypes.contains(recordType) group.addTask { var apexRecords: [DNSRecord] = [] var wildcardRecords: [DNSRecord] = [] @@ -57,7 +58,7 @@ struct DNSLookupService { } // Wildcard query (only for applicable types, and only if apex didn't fail) - if wildcardTypes.contains(recordType) && lookupError == nil { + if shouldQueryWildcard && lookupError == nil { do { wildcardRecords = try await lookup(domain: "*.\(domain)", recordType: recordType) } catch { -- cgit v1.2.3