DNS is a very commonly needed protocol. Currently, SwiftNIO based applications use the operating system's synchronous calls for resolving domain names. Aside from this, there's a lack of feature support in the POSIX defined APIs. This can prevent software from accessing resource records like SRV and TXT.
My personal motiviation is the MongoKitten project, where I need(ed) to access TXT and SRV records as described above. This needs to support iOS, macOS, and Linux.
An example implementation
There is an example implementation of a DNS Client available at OpenKitten/NioDNS. I think there's a lot of work to be done, specifically in unit tests and features. The internals seem pretty reliable so far.
A synchronous example of NioDNS for simplicity. Note that the intended use case of NioDNS is specifically not synchronous.
import NIODNS let eventLoop: EventLoop = ... // 220.127.116.11 could be another DNS Server and if left empty // is read from the `/etc/resolv.conf` file let dnsClient = try DNSClient.connect(to: "18.104.22.168", on: eventLoop).wait() let records: [TxtRecord] = try dnsClient.fetchRecords(TxtRecord.self, forDomain: "example.com").wait()