SkillAgentSearch skills...

DnsClientX

DnsClientX is an async C# library for DNS over UDP, TCP, HTTPS (DoH), and TLS (DoT). It also has a PowerShell module that can be used to query DNS records. It provides a simple way to query DNS records using multiple DNS providers. It supports multiple DNS record types and parallel queries.

Install / Use

/learn @EvotecIT/DnsClientX
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

DnsClientX - Modern DNS Client for .NET and PowerShell

DnsClientX is available as NuGet from the Nuget Gallery and as PowerShell module from PSGallery

📦 NuGet Package

nuget downloads nuget version

💻 PowerShell Module

powershell gallery version powershell gallery preview powershell gallery platforms powershell gallery downloads

🛠️ Project Information

top language license codecov

👨‍💻 Author & Social

Twitter follow Blog LinkedIn Threads Discord

What it's all about

DnsClientX is an async C# library for DNS over UDP, TCP, HTTPS (DoH), and TLS (DoT). It also has a PowerShell module that can be used to query DNS records. It provides a simple way to query DNS records using multiple DNS providers. It supports multiple DNS record types and parallel queries. It's available for .NET 8, .NET 10, .NET Standard 2.0, and .NET 4.7.2.

Response Format Options: Typed vs Non-Typed Records

DnsClientX gives you two ways to work with DNS query results, depending on your needs:

🔤 Non-Typed Records (Default)

Returns DNS data as raw strings - simple and straightforward:

var response = await ClientX.QueryDns("google.com", DnsRecordType.MX, DnsEndpoint.Cloudflare);
foreach (var answer in response.Answers) {
    Console.WriteLine($"Raw data: {answer.Data}"); // "10 smtp.google.com"
}

🎯 Typed Records (Strongly-Typed)

Automatically parses DNS data into strongly-typed .NET objects with properties:

var response = await client.Resolve("google.com", DnsRecordType.MX, typedRecords: true);
foreach (var answer in response.TypedAnswers!) {
    if (answer is MxRecord mx) {
        Console.WriteLine($"Mail server: {mx.Exchange}, Priority: {mx.Preference}");
    }
}

When to use each approach:

  • Non-typed: Quick queries, simple data extraction, minimal processing
  • Typed: Complex applications, structured data processing, type safety, IntelliSense support

Both approaches work with all DNS record types and all query methods - simply add typedRecords: true to any query to get strongly-typed results.

Supported DNS Providers

It provides querying multiple DNS Providers.

| Endpoint | DoH | DoQ | DoT | UDP | TCP | DnsCrypt | ODoH | | ------------------------ | --- | --- | --- | --- | --- | -------- | ---- | | System | | | | ✓ | | | | | SystemTcp | | | | | ✓ | | | | Cloudflare | ✓ | | | | | | | | CloudflareWireFormat | ✓ | | | | | | | | CloudflareWireFormatPost | ✓ | | | | | | | | CloudflareSecurity | ✓ | | | | | | | | CloudflareFamily | ✓ | | | | | | | | CloudflareQuic | | ✓ | | | | | | | CloudflareOdoh | | | | | | | ❌ | | Google | ✓ | | | | | | | | GoogleWireFormat | ✓ | | | | | | | | GoogleWireFormatPost | ✓ | | | | | | | | GoogleQuic | | ✓ | | | | | | | AdGuard | ✓ | | | | | | | | AdGuardFamily | ✓ | | | | | | | | AdGuardNonFiltering | ✓ | | | | | | | | Quad9 | ✓ | | | | | | | | Quad9ECS | ✓ | | | | | | | | Quad9Unsecure | ✓ | | | | | | | | OpenDNS | ✓ | | | | | | | | OpenDNSFamily | ✓ | | | | | | | | DnsCryptCloudflare | | | | | | ❌ | | | DnsCryptQuad9 | | | | | | ❌ | | | DnsCryptRelay | | | | | | ❌ | | | RootServer | | | | ✓ | ✓ | | |

If you want to learn about DNS:

  • https://www.cloudflare.com/learning/dns/what-is-dns/

[!WARNING] We try to unify the responses as much as possible for common use cases by translating on the fly. This is because different providers do not store it always the same way. If you find discrepancies please open an issue or better pull request.

Supported .NET Versions and Dependencies

Core Library (DnsClientX)

  • .NET 8.0 / .NET 10.0 (Windows, Linux, macOS)
    • No external dependencies
  • .NET Standard 2.0 (Cross-platform compatibility)
    • System.Text.Json (10.0.5)
    • Microsoft.Bcl.AsyncInterfaces (10.0.5)
  • .NET Framework 4.7.2 (Windows only)
    • System.Net.Http (built-in)
    • System.Text.Json (10.0.5)
    • Microsoft.Bcl.AsyncInterfaces (10.0.5)

Command Line Interface (DnsClientX.exe)

  • .NET 8.0 / .NET 10.0 (Windows, Linux, macOS)
  • .NET Framework 4.7.2 (Windows only)
  • Single-file deployment supported

PowerShell Module

  • .NET 8.0 (Cross-platform)
  • .NET Standard 2.0 (Windows PowerShell 5.1+ compatibility)
  • .NET Framework 4.7.2 (Windows PowerShell 5.1)
  • PowerShellStandard.Library (5.1.1)

Examples Project

  • .NET 8.0 only
  • Spectre.Console (0.54.0) for enhanced console output

Build Status

Test .NET Test PowerShell codecov

Cross-Platform Testing: All tests run simultaneously across Windows, Linux, and macOS to ensure compatibility.

Features

  • [x] Supports multiple built-in DNS Providers (System, Cloudflare, Google, Quad9, OpenDNS, etc.)
  • [x] Supports both JSON and Wireformat
  • [x] Supports DNS over HTTPS (DoH) using GET and POST methods
  • [x] Supports DNS over TLS (DoT)
  • [x] Supports DNS over UDP, and switches to TCP if needed
  • [x] Supports DNS over TCP
  • [x] Supports DNSSEC
  • [x] Supports multiple DNS record types
  • [x] Supports parallel queries
  • [x] No external dependencies on .NET 8 and .NET 10
  • [x] Minimal dependencies on .NET Standard 2.0 and .NET 4.7.2
  • [x] Implements IDisposable to release cached HttpClient resources
  • [x] Multi-line record data normalized to use \n line endings
  • [x] Supports DNS Service Discovery (DNS-SD)

Understanding DNS Query Behavior

Different Results from Different Providers

When querying DNS records using DnsClientX, you may notice that different DNS providers can return different results for the same domain. This is normal behavior and occurs for several legitimate reasons:

Content Delivery Networks (CDNs)

Many popular websites use CDNs (like Cloudflare, Akamai, AWS CloudFront) to serve content from servers geographically closer to users. CDN-backed domains will return different IP addresses based on:

  • Geographic location: Providers route queries to the nearest edge server
  • Provider routing policies: Different DNS providers may have different relationships with CDNs
  • Load balancing: CDNs dynamically distribute traffic across multiple servers

Example: A domain like www.example.com might return:

  • From Cloudflare: 23.47.124.71, 23.47.124.85
  • From OpenDNS: 185.225.251.105, 185.225.251.40

Both responses are correct - they're just optimized for different network paths.

DNS Provider Characteristics

Different DNS providers have distinct characteristics:

  • Cloudflare (1.1.1.1): Privacy-focused, fast, global Anycast network
  • Google (8.8.8.8): Extensive caching, Google's global infrastructure
  • Quad9 (9.9.9.9): Security-focused, blocks malicious domains
  • OpenDNS: Content filtering options, enterprise features

| Provider | H

Related Skills

View on GitHub
GitHub Stars23
CategoryCustomer
Updated2d ago
Forks3

Languages

C#

Security Score

95/100

Audited on Mar 24, 2026

No findings