|
2 | 2 | // |
3 | 3 | // This source file is part of the SwiftAsyncDNSResolver open source project |
4 | 4 | // |
5 | | -// Copyright (c) 2023 Apple Inc. and the SwiftAsyncDNSResolver project authors |
| 5 | +// Copyright (c) 2023-2024 Apple Inc. and the SwiftAsyncDNSResolver project authors |
6 | 6 | // Licensed under Apache License v2.0 |
7 | 7 | // |
8 | 8 | // See LICENSE.txt for license information |
|
16 | 16 | import dnssd |
17 | 17 |
|
18 | 18 | /// ``DNSResolver`` implementation backed by dnssd framework. |
| 19 | +@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) |
19 | 20 | public struct DNSSDDNSResolver: DNSResolver { |
20 | 21 | let dnssd: DNSSD |
21 | 22 |
|
@@ -98,6 +99,7 @@ extension QueryType { |
98 | 99 |
|
99 | 100 | // MARK: - dnssd query wrapper |
100 | 101 |
|
| 102 | +@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) |
101 | 103 | struct DNSSD { |
102 | 104 | // Reference: https://gist.github.com/fikeminkel/a9c4bc4d0348527e8df3690e242038d3 |
103 | 105 | func query<ReplyHandler: DNSSDQueryReplyHandler>( |
@@ -167,6 +169,7 @@ struct DNSSD { |
167 | 169 |
|
168 | 170 | // MARK: - dnssd query reply handler |
169 | 171 |
|
| 172 | +@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) |
170 | 173 | extension DNSSD { |
171 | 174 | struct QueryReplyHandler { |
172 | 175 | private let _handleRecord: (DNSServiceErrorType, UnsafeRawPointer?, UInt16) -> Void |
@@ -208,6 +211,7 @@ protocol DNSSDQueryReplyHandler { |
208 | 211 | func generateReply(records: [Record]) throws -> Reply |
209 | 212 | } |
210 | 213 |
|
| 214 | +@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) |
211 | 215 | extension DNSSD { |
212 | 216 | // Reference: https://github.com/orlandos-nl/DNSClient/blob/master/Sources/DNSClient/Messages/Message.swift |
213 | 217 |
|
@@ -450,6 +454,7 @@ extension DNSSDQueryReplyHandler { |
450 | 454 | return parts.isEmpty ? nil : parts.joined(separator: ".") |
451 | 455 | } |
452 | 456 |
|
| 457 | + @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) |
453 | 458 | func ensureOne<R>(records: [R]) throws -> R { |
454 | 459 | guard records.count <= 1 else { |
455 | 460 | throw AsyncDNSResolver.Error.badResponse("expected 1 record but got \(records.count)") |
|
0 commit comments