init(channel:dnsServerAddress:context:)
Create a new DNSClient that will send queries to the specified address using your own Channel.
init(channel: any Channel, dnsServerAddress: SocketAddress, context: DNSClientContext) Create a new DNSClient that will send queries to the specified address using your own Channel.
init(channel: any Channel, dnsServerAddress: SocketAddress, context: DNSClientContext) s9DNSClientAAC7channel16dnsServerAddress7contextAB7NIOCore7Channel_p_AF06SocketE0OAA0A7ContextVtcfc What are these?5T1FZimport DNSClientfinal class DNSClientA DNS client that can be used to send queries to a DNS server. The client is thread-safe and can be used from multiple threads. Supports both UDP and TCP, and multicast DNS. This client is not a full implementation of the DNS protocol, but only supports the most common queries. If you need more advanced features, you should use the sendQuery method to send a custom query. This client is not a full resolver, and does not support caching, recursion, or other advanced features. If you need a full resolver, use the Resolver class.
struct DNSClientContextA context that can be used to create a DNSClient. This can be used to create only one DNSClient, but is useful if you want to use your own Channel.
static func connect(on group: any EventLoopGroup) -> EventLoopFuture<DNSClient> Connect to the dns server
static func connect(on group: any EventLoopGroup, config: [SocketAddress]) -> EventLoopFuture<DNSClient> Connect to the dns server and return a future with the client. This method will use UDP.
static func connect(on group: any EventLoopGroup, host: String) -> EventLoopFuture<DNSClient> Connect to the dns server
static func connectMulticast(on group: any EventLoopGroup) -> EventLoopFuture<DNSClient> Creates a multicast DNS client. This client will join the multicast group and listen for responses. It will also send queries to the multicast group.
static func connectTCP(on group: any EventLoopGroup) -> EventLoopFuture<DNSClient> Connect to the dns server using TCP
static func connectTCP(on group: any EventLoopGroup, config: [SocketAddress]) -> EventLoopFuture<DNSClient> Connect to the dns server using TCP and return a future with the client.
static func connectTCP(on group: any EventLoopGroup, host: String) -> EventLoopFuture<DNSClient> Connect to the dns server using TCP
static func initializeChannel(_ channel: any Channel, context: DNSClientContext, asEnvelopeTo remoteAddress: SocketAddress? = nil) -> EventLoopFuture<Void> Set up the UDP channel to use the DNS protocol.
func cancelQueries() Cancel all queries that are currently running. This will fail all futures with a CancelError
func getSRVRecords(from host: String) -> EventLoopFuture<[ResourceRecord<SRVRecord>]> Request SRV records from a host
func initiateAAAAQuery(host: String, port: Int) -> EventLoopFuture<[SocketAddress]> Request AAAA records
func initiateAQuery(host: String, port: Int) -> EventLoopFuture<[SocketAddress]> Request A records
func initiateNSQuery(forDomain domain: String) -> EventLoopFuture<[ResourceRecord<NSRecord>]> Request NS records for a domain
func initiateSOAQuery(forDomain domain: String) -> EventLoopFuture<[ResourceRecord<SOARecord>]> Request SOA records from a host
func ipv4InverseAddress(_ address: String) -> EventLoopFuture<[ResourceRecord<PTRRecord>]> Request IPv4 inverse address (PTR records) from nameserver
func ipv6InverseAddress(_ address: String) -> EventLoopFuture<[ResourceRecord<PTRRecord>]> Request IPv6 inverse address (PTR records) from nameserver
func sendQuery(forHost address: String, type: DNSResourceType, additionalOptions: MessageOptions? = nil, timeout: TimeAmount = .seconds(30)) -> EventLoopFuture<Message> Send a question to the dns host