diff options
| author | Christian Cleberg <[email protected]> | 2026-03-18 11:59:38 -0500 |
|---|---|---|
| committer | Christian Cleberg <[email protected]> | 2026-03-18 11:59:38 -0500 |
| commit | 376e7b55b4a0c4f54faa0c2828dea4fd17dff288 (patch) | |
| tree | 540d11ad423f14975553f2490617e05aea61ae2c /DomainDig/DNSLookupService.swift | |
| parent | e11b7d29a6aa9e52f63fcb35ee7ed9127850fffe (diff) | |
| download | domain-dig-376e7b55b4a0c4f54faa0c2828dea4fd17dff288.tar.gz domain-dig-376e7b55b4a0c4f54faa0c2828dea4fd17dff288.tar.bz2 domain-dig-376e7b55b4a0c4f54faa0c2828dea4fd17dff288.zip | |
realigning commits
Diffstat (limited to 'DomainDig/DNSLookupService.swift')
| -rw-r--r-- | DomainDig/DNSLookupService.swift | 9 |
1 files changed, 5 insertions, 4 deletions
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<DNSRecordType> = [.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<DNSRecordType> = [.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 { |
