Modern DNS client using DNS-over-HTTPS (DoH) for secure and efficient domain name resolution.
License
—
Deps
4
Install Size
—
Vulns
✓ 0
Published
Nov 12, 2025
$ dotnet add package Nager.DnsNager.Dns is a simple and powerful C# DNS client that securely performs DNS queries using DNS over HTTPS (DoH). It supports multiple DNS providers and offers an easy-to-use API.
Perform DNS queries for multiple domains at once:
var serviceProvider = new ServiceCollection().AddHttpClient().BuildServiceProvider();
var httpClientFactory = serviceProvider.GetService<IHttpClientFactory>();
var dnsQuestions = new DnsQuestion[]
{
new DnsQuestion("google.com", DnsRecordType.A),
new DnsQuestion("microsoft.com", DnsRecordType.A)
};
var dnsClient = new DnsClient(httpClientFactory);
var responses = await dnsClient.BulkDnsQueryAsync(dnsQuestions, DnsProvider.Google);
Perform a DNS query for a single domain:
var serviceProvider = new ServiceCollection().AddHttpClient().BuildServiceProvider();
var httpClientFactory = serviceProvider.GetService<IHttpClientFactory>();
var dnsClient = new DnsClient(httpClientFactory);
var responses = await dnsClient.DnsQueryAsync(new DnsQuestion("google.com", DnsRecordType.A), DnsProvider.Google);
We welcome feedback, feature requests, and contributions! Feel free to open an issue or submit a pull request.