Show / Hide Table of Contents

Class DohClient

Client to a DNS server over HTTPS.

Inheritance
Object
DnsClientBase
DohClient
Implements
IDnsClient
IDisposable
IResolver
Inherited Members
DnsClientBase.ThrowResponseError
DnsClientBase.NextQueryId()
DnsClientBase.ResolveAsync(DomainName, CancellationToken)
DnsClientBase.QueryAsync(DomainName, DnsType, CancellationToken)
DnsClientBase.SecureQueryAsync(DomainName, DnsType, CancellationToken)
DnsClientBase.ResolveAsync(IPAddress, CancellationToken)
DnsClientBase.Dispose()
DnsClientBase.Dispose(Boolean)
DnsClientBase.ResolveAsync(Message, CancellationToken)
Object.ToString()
Object.Equals(Object)
Object.Equals(Object, Object)
Object.ReferenceEquals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Namespace: Makaretu.Dns
Assembly: Makaretu.Dns.Unicast.dll
Syntax
public class DohClient : DnsClientBase, IDnsClient, IDisposable, IResolver
Remarks

DNS over HTTPS (DoH) is an experimental protocol for performing remote Domain Name System (DNS) resolution via the HTTPS protocol. The goal is to increase user privacy and security by preventing eavesdropping and manipulation of DNS data by man-in-the-middle attacks.

The DohClient uses the HTTP POST method to hide as much information as is possible. Also, it tends to generate smaller requests.

Fields

| Improve this Doc View Source

DnsJsonFormat

The MIME type for a DNS message encoded in JSON.

Declaration
public const string DnsJsonFormat = "application/dns-json"
Field Value
Type Description
String
| Improve this Doc View Source

DnsWireFormat

The MIME type for a DNS message encoded in UPD wire format.

Declaration
public const string DnsWireFormat = "application/dns-message"
Field Value
Type Description
String
Remarks

Previous drafts defined this as "application/dns-udpwireformat".

Properties

| Improve this Doc View Source

HttpClient

The client that sends HTTP requests and receives HTTP responses.

Declaration
public HttpClient HttpClient { get; set; }
Property Value
Type Description
HttpClient
Remarks

It is best practice to use only one HttpClient in an application.

| Improve this Doc View Source

ServerUrl

The DNS server to communication with.

Declaration
public string ServerUrl { get; set; }
Property Value
Type Description
String

Defaults to "https://cloudflare-dns.com/dns-query";.

| Improve this Doc View Source

Timeout

Time to wait for a DNS response.

Declaration
public TimeSpan Timeout { get; set; }
Property Value
Type Description
TimeSpan

The default is 4 seconds.

Methods

| Improve this Doc View Source

QueryAsync(Message, CancellationToken)

Send a DNS query with the specified message.

Declaration
public override Task<Message> QueryAsync(Message request, CancellationToken cancel = default(CancellationToken))
Parameters
Type Name Description
Message request

A Message containing a Question.

CancellationToken cancel

Is used to stop the task. When cancelled, the TaskCanceledException is raised.

Returns
Type Description
Task<Message>

A task that represents the asynchronous operation. The task's value contains the response Message.

Overrides
DnsClientBase.QueryAsync(Message, CancellationToken)
Exceptions
Type Condition
IOException

When the DNS server returns error status or no response.

Implements

IDnsClient
System.IDisposable
IResolver

See Also

https://en.wikipedia.org/wiki/DNS_over_HTTPS
  • Improve this Doc
  • View Source
Back to top Generated by DocFX