-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds DnsNotImplementedClient as a "no op" responder.
- Loading branch information
1 parent
1cc6e8e
commit 896bb42
Showing
2 changed files
with
34 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using Ae.Dns.Protocol.Enums; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
|
||
namespace Ae.Dns.Protocol | ||
{ | ||
/// <summary> | ||
/// A client which only returns a <see cref="DnsResponseCode.NotImp"/> code. | ||
/// </summary> | ||
public sealed class DnsNotImplementedClient : IDnsClient | ||
{ | ||
/// <summary> | ||
/// A static instance of this client which can be used to avoid allocating a new one. | ||
/// </summary> | ||
public static readonly IDnsClient Instance = new DnsNotImplementedClient(); | ||
|
||
/// <inheritdoc/> | ||
public void Dispose() | ||
{ | ||
} | ||
|
||
/// <inheritdoc/> | ||
public Task<DnsMessage> Query(DnsMessage query, CancellationToken token = default) | ||
{ | ||
return Task.FromResult(query.CreateErrorMessage(DnsResponseCode.NotImp, ToString())); | ||
} | ||
|
||
/// <inheritdoc/> | ||
public override string ToString() => nameof(DnsNotImplementedClient); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters