Class DotClient
Client to a DNS server over TLS.
Inherited Members
Namespace: Makaretu.Dns
Assembly: Makaretu.Dns.Unicast.dll
Syntax
public class DotClient : DnsClientBase, IDnsClient, IDisposable, IResolver
Remarks
DNS over TLS is a security protocol for encrypting and wrapping DNS queries and answers via the Transport Layer Security (TLS) protocol. The goal is to increase user privacy and security by preventing eavesdropping and manipulation of DNS data via man-in-the-middle attacks.
All queries are padded to the closest multiple of BlockLength octets.
Fields
| Improve this Doc View SourceDefaultPort
The default port of a DOT server.
Declaration
public const int DefaultPort = 853
Field Value
Type | Description |
---|---|
Int32 |
PublicServers
Known servers that support DNS over TLS.
Declaration
public static DotEndPoint[] PublicServers
Field Value
Type | Description |
---|---|
DotEndPoint[] | Sequence of known servers. |
Remarks
This is the default list that Servers uses.
Properties
| Improve this Doc View SourceBlockLength
The number of octets for padding.
Declaration
public int BlockLength { get; set; }
Property Value
Type | Description |
---|---|
Int32 | Defaults to 128. |
Remarks
All queries are padded to the closest multiple of BlockLength octets.
See Also
| Improve this Doc View SourceServers
The DNS over TLS servers to communication with.
Declaration
public IEnumerable<DotEndPoint> Servers { get; set; }
Property Value
Type | Description |
---|---|
IEnumerable<DotEndPoint> | A sequence of DOT endpoints. The default is the PublicServers. |
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 SourceDispose(Boolean)
Dispose the client.
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
Boolean | disposing | true if managed resources should be disposed. |
Overrides
| Improve this Doc View SourceGetDnsServerAsync()
Get the stream to a DNS server.
Declaration
public Task<Stream> GetDnsServerAsync()
Returns
Type | Description |
---|---|
Task<Stream> |
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 | |
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
Remarks
Sends the request
and waits for
the matching response.
Exceptions
Type | Condition |
---|---|
IOException | When the DNS server returns error status or no response. |