This library provides an easy interface for interacting with Cloudflare's DNS over HTTPS endpoints.
DoH is a protocol that enhances the privacy and security of DNS queries by encrypting them using HTTPS. This helps prevent unauthorized access or tampering of DNS data during transmission. Learn more about it here.
To get started, import the library into your solution with either the NuGet Package Manager
or the dotnet
CLI.
dotnet add package DnsOverHttps
For the primary class to become available, import the used namespace.
using DnsOverHttps;
Need more examples? Under the Example
directory you can find a working demo project that implements this library.
- Built for .NET 8, .NET 7 and .NET 6
- Fully async
- Extensive XML documentation
- No external dependencies (makes use of built-in
HttpClient
andJsonSerializer
) - Custom exceptions (
DnsOverHttpsException
) for easy debugging - Example project to demonstrate all capabilities of the library
- Resolve one or all DNS records under a hostname
- Ask for DNSSEC validation
- Query in parallel
- Specify advanced parameters
DnsOverHttpsClient dns = new();
Response response = await dns.Resolve("discord.com", ResourceRecordType.A, true, true);
Answer? nsAnswer = await dns.ResolveFirst("example.com", ResourceRecordType.NS);
Answer[] aAnswers = await dns.ResolveAll("reddit.com", ResourceRecordType.A);
- Cloudflare: https://cloudflare.com
- 1.1.1.1: https://1.1.1.1
- Introduction: https://developers.cloudflare.com/1.1.1.1/encryption/dns-over-https
This is a community-ran library. Not affiliated with Cloudflare, Inc.
Icon made by Freepik at Flaticon.