Class LookupClient
The LookupClient is the main query class of this library and should be used for any kind of DNS lookup query.
It implements ILookupClient and IDnsQuery which contains a number of extension methods, too. The extension methods internally all invoke the standard IDnsQuery queries though.
Inherited Members
Namespace: DnsClient
Assembly: DnsClient.dll
Syntax
public class LookupClient : ILookupClient, IDnsQuery
Examples
A basic example wihtout specifying any DNS server, which will use the DNS server configured by your local network.
var client = new LookupClient();
var result = client.Query("google.com", QueryType.A);
foreach (var aRecord in result.Answers.ARecords())
{
Console.WriteLine(aRecord);
}
Constructors
| Improve this Doc View SourceLookupClient()
Creates a new instance of LookupClient without specifying any name server. This will implicitly use the name server(s) configured by the local network adapter(s).
Declaration
public LookupClient()
Remarks
This uses ResolveNameServers(Boolean, Boolean). The resulting list of name servers is highly dependent on the local network configuration and OS.
Examples
In the following example, we will create a new LookupClient without explicitly defining any DNS server. This will use the DNS server configured by your local network.
var client = new LookupClient();
var result = client.Query("google.com", QueryType.A);
foreach (var aRecord in result.Answers.ARecords())
{
Console.WriteLine(aRecord);
}
|
Improve this Doc
View Source
LookupClient(LookupClientOptions)
Creates a new instance of LookupClient with custom settings.
Declaration
public LookupClient(LookupClientOptions options)
Parameters
Type | Name | Description |
---|---|---|
LookupClientOptions | options | The options to use with this LookupClient instance. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | If |
LookupClient(NameServer[])
Creates a new instance of LookupClient with default settings and the given name servers.
Declaration
public LookupClient(params NameServer[] nameServers)
Parameters
Type | Name | Description |
---|---|---|
NameServer[] | nameServers | The NameServer(s) to be used by this LookupClient instance. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | If |
LookupClient(IPAddress, Int32)
Create a new instance of LookupClient with default settings and one DNS server defined by address
and port
.
Declaration
public LookupClient(IPAddress address, int port)
Parameters
Type | Name | Description |
---|---|---|
IPAddress | address | The IPAddress of the DNS server. |
Int32 | port | The port of the DNS server. |
Examples
Connecting to one specific DNS server which does not run on the default port 53
:
var client = new LookupClient(IPAddress.Parse("127.0.0.1"), 8600);
Exceptions
Type | Condition |
---|---|
ArgumentNullException | If |
LookupClient(IPAddress[])
Creates a new instance of LookupClient with default settings and one or more DNS servers identified by their IPAddress.
The default port 53
will be used for all IPAddresss provided.
Declaration
public LookupClient(params IPAddress[] nameServers)
Parameters
Type | Name | Description |
---|---|---|
IPAddress[] | nameServers | The IPAddress(s) to be used by this LookupClient instance. |
Examples
Connecting to one or more DNS server using the default port:
// configuring the client to use google's public IPv4 DNS servers.
var client = new LookupClient(IPAddress.Parse("8.8.8.8"), IPAddress.Parse("8.8.4.4"));
Exceptions
Type | Condition |
---|---|
ArgumentNullException | If |
LookupClient(IPEndPoint[])
Creates a new instance of LookupClient with default settings and the given name servers.
Declaration
public LookupClient(params IPEndPoint[] nameServers)
Parameters
Type | Name | Description |
---|---|---|
IPEndPoint[] | nameServers | The IPEndPoint(s) to be used by this LookupClient instance. |
Examples
Connecting to one specific DNS server which does not run on the default port 53
:
var endpoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 8600);
var client = new LookupClient(endpoint);
The NameServer class also contains pre defined IPEndPoints for the public google DNS servers, which can be used as follows:
var client = new LookupClient(NameServer.GooglePublicDns, NameServer.GooglePublicDnsIPv6);
Exceptions
Type | Condition |
---|---|
ArgumentNullException | If |
Properties
| Improve this Doc View SourceContinueOnDnsError
Declaration
[Obsolete("This property will be removed from LookupClient in the next version. Use LookupClientOptions to initialize LookupClient instead.")]
public bool ContinueOnDnsError { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
EnableAuditTrail
Declaration
[Obsolete("This property will be removed from LookupClient in the next version. Use LookupClientOptions to initialize LookupClient instead.")]
public bool EnableAuditTrail { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
MinimumCacheTimeout
Declaration
[Obsolete("This property will be removed from LookupClient in the next version. Use LookupClientOptions to initialize LookupClient instead.")]
public TimeSpan? MinimumCacheTimeout { get; set; }
Property Value
Type | Description |
---|---|
Nullable<TimeSpan> |
NameServers
Gets the list of configured or resolved name servers of the ILookupClient instance.
Declaration
public IReadOnlyCollection<NameServer> NameServers { get; }
Property Value
Type | Description |
---|---|
IReadOnlyCollection<NameServer> |
Recursion
Declaration
[Obsolete("This property will be removed from LookupClient in the next version. Use LookupClientOptions to initialize LookupClient instead.")]
public bool Recursion { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
Retries
Declaration
[Obsolete("This property will be removed from LookupClient in the next version. Use LookupClientOptions to initialize LookupClient instead.")]
public int Retries { get; set; }
Property Value
Type | Description |
---|---|
Int32 |
Settings
Gets the configured settings of the ILookupClient instance.
Declaration
public LookupClientSettings Settings { get; }
Property Value
Type | Description |
---|---|
LookupClientSettings |
ThrowDnsErrors
Declaration
[Obsolete("This property will be removed from LookupClient in the next version. Use LookupClientOptions to initialize LookupClient instead.")]
public bool ThrowDnsErrors { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
Timeout
Declaration
[Obsolete("This property will be removed from LookupClient in the next version. Use LookupClientOptions to initialize LookupClient instead.")]
public TimeSpan Timeout { get; set; }
Property Value
Type | Description |
---|---|
TimeSpan |
UseCache
Declaration
[Obsolete("This property will be removed from LookupClient in the next version. Use LookupClientOptions to initialize LookupClient instead.")]
public bool UseCache { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
UseRandomNameServer
Declaration
[Obsolete("This property will be removed from LookupClient in the next version. Use LookupClientOptions to initialize LookupClient instead.")]
public bool UseRandomNameServer { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
UseTcpFallback
Declaration
[Obsolete("This property will be removed from LookupClient in the next version. Use LookupClientOptions to initialize LookupClient instead.")]
public bool UseTcpFallback { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
UseTcpOnly
Declaration
[Obsolete("This property will be removed from LookupClient in the next version. Use LookupClientOptions to initialize LookupClient instead.")]
public bool UseTcpOnly { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
Methods
| Improve this Doc View SourceGetReverseQuestion(IPAddress)
Gets a reverse lookup question for an IPAddress.
Declaration
public static DnsQuestion GetReverseQuestion(IPAddress ipAddress)
Parameters
Type | Name | Description |
---|---|---|
IPAddress | ipAddress | The address. |
Returns
Type | Description |
---|---|
DnsQuestion | A DnsQuestion with the proper arpa domain query for the given address. |
Query(DnsQuestion)
Performs a DNS lookup for the given question
.
Declaration
public IDnsQueryResponse Query(DnsQuestion question)
Parameters
Type | Name | Description |
---|---|---|
DnsQuestion | question | The domain name query. |
Returns
Type | Description |
---|---|
IDnsQueryResponse | The IDnsQueryResponse which contains the response headers and lists of resource records. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | If |
DnsResponseException | After retries and fallbacks, if none of the servers were accessible, timed out or (if ThrowDnsErrors is enabled) returned error results. |
Query(DnsQuestion, DnsQueryAndServerOptions)
Performs a DNS lookup for the given question
.
Declaration
public IDnsQueryResponse Query(DnsQuestion question, DnsQueryAndServerOptions queryOptions)
Parameters
Type | Name | Description |
---|---|---|
DnsQuestion | question | The domain name query. |
DnsQueryAndServerOptions | queryOptions | Query options to be used instead of LookupClient's settings. |
Returns
Type | Description |
---|---|
IDnsQueryResponse | The IDnsQueryResponse which contains the response headers and lists of resource records. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | If |
DnsResponseException | After retries and fallbacks, if none of the servers were accessible, timed out or (if ThrowDnsErrors is enabled) returned error results. |
Query(String, QueryType, QueryClass)
Performs a DNS lookup for the given query
, queryType
and queryClass
.
Declaration
public IDnsQueryResponse Query(string query, QueryType queryType, QueryClass queryClass = QueryClass.IN)
Parameters
Type | Name | Description |
---|---|---|
String | query | The domain name query. |
QueryType | queryType | The QueryType. |
QueryClass | queryClass | The QueryClass. |
Returns
Type | Description |
---|---|
IDnsQueryResponse | The IDnsQueryResponse which contains the response headers and lists of resource records. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | If |
DnsResponseException | After retries and fallbacks, if none of the servers were accessible, timed out or (if ThrowDnsErrors is enabled) returned error results. |
QueryAsync(DnsQuestion, DnsQueryAndServerOptions, CancellationToken)
Performs a DNS lookup for the given question
.
Declaration
public Task<IDnsQueryResponse> QueryAsync(DnsQuestion question, DnsQueryAndServerOptions queryOptions, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
DnsQuestion | question | The domain name query. |
DnsQueryAndServerOptions | queryOptions | Query options to be used instead of LookupClient's settings. |
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task<IDnsQueryResponse> | The IDnsQueryResponse which contains the response headers and lists of resource records. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | If |
DnsResponseException | After retries and fallbacks, if none of the servers were accessible, timed out or (if ThrowDnsErrors is enabled) returned error results. |
QueryAsync(DnsQuestion, CancellationToken)
Performs a DNS lookup for the given question
.
Declaration
public Task<IDnsQueryResponse> QueryAsync(DnsQuestion question, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
DnsQuestion | question | The domain name query. |
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task<IDnsQueryResponse> | The IDnsQueryResponse which contains the response headers and lists of resource records. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | If |
DnsResponseException | After retries and fallbacks, if none of the servers were accessible, timed out or (if ThrowDnsErrors is enabled) returned error results. |
QueryAsync(String, QueryType, QueryClass, CancellationToken)
Performs a DNS lookup for the given query
, queryType
and queryClass
Declaration
public Task<IDnsQueryResponse> QueryAsync(string query, QueryType queryType, QueryClass queryClass = QueryClass.IN, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
String | query | The domain name query. |
QueryType | queryType | The QueryType. |
QueryClass | queryClass | The QueryClass. |
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task<IDnsQueryResponse> | The IDnsQueryResponse which contains the response headers and lists of resource records. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | If |
OperationCanceledException | If cancellation has been requested for the passed in |
DnsResponseException | After retries and fallbacks, if none of the servers were accessible, timed out or (if ThrowDnsErrors is enabled) returned error results. |
QueryReverse(IPAddress)
Does a reverse lookup for the ipAddress
.
Declaration
public IDnsQueryResponse QueryReverse(IPAddress ipAddress)
Parameters
Type | Name | Description |
---|---|---|
IPAddress | ipAddress | The IPAddress. |
Returns
Type | Description |
---|---|
IDnsQueryResponse | The IDnsQueryResponse which might contain the PtrRecord for the |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | If |
DnsResponseException | After retries and fallbacks, if none of the servers were accessible, timed out or (if ThrowDnsErrors is enabled) returned error results. |
QueryReverse(IPAddress, DnsQueryAndServerOptions)
Does a reverse lookup for the ipAddress
.
Declaration
public IDnsQueryResponse QueryReverse(IPAddress ipAddress, DnsQueryAndServerOptions queryOptions)
Parameters
Type | Name | Description |
---|---|---|
IPAddress | ipAddress | The IPAddress. |
DnsQueryAndServerOptions | queryOptions | Query options to be used instead of LookupClient's settings. |
Returns
Type | Description |
---|---|
IDnsQueryResponse | The IDnsQueryResponse which might contain the PtrRecord for the |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | If |
DnsResponseException | After retries and fallbacks, if none of the servers were accessible, timed out or (if ThrowDnsErrors is enabled) returned error results. |
QueryReverseAsync(IPAddress, DnsQueryAndServerOptions, CancellationToken)
Does a reverse lookup for the ipAddress
.
Declaration
public Task<IDnsQueryResponse> QueryReverseAsync(IPAddress ipAddress, DnsQueryAndServerOptions queryOptions, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
IPAddress | ipAddress | The IPAddress. |
DnsQueryAndServerOptions | queryOptions | Query options to be used instead of LookupClient's settings. |
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task<IDnsQueryResponse> | The IDnsQueryResponse which might contain the PtrRecord for the |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | If |
OperationCanceledException | If cancellation has been requested for the passed in |
DnsResponseException | After retries and fallbacks, if none of the servers were accessible, timed out or (if ThrowDnsErrors is enabled) returned error results. |
QueryReverseAsync(IPAddress, CancellationToken)
Does a reverse lookup for the ipAddress
.
Declaration
public Task<IDnsQueryResponse> QueryReverseAsync(IPAddress ipAddress, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
IPAddress | ipAddress | The IPAddress. |
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task<IDnsQueryResponse> | The IDnsQueryResponse which might contain the PtrRecord for the |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | If |
OperationCanceledException | If cancellation has been requested for the passed in |
DnsResponseException | After retries and fallbacks, if none of the servers were accessible, timed out or (if ThrowDnsErrors is enabled) returned error results. |
QueryServer(IReadOnlyCollection<NameServer>, DnsQuestion)
Performs a DNS lookup for the given question
using only the passed in servers
.
Declaration
public IDnsQueryResponse QueryServer(IReadOnlyCollection<NameServer> servers, DnsQuestion question)
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyCollection<NameServer> | servers | The list of one or more server(s) which should be used for the lookup. |
DnsQuestion | question | The domain name query. |
Returns
Type | Description |
---|---|
IDnsQueryResponse | The IDnsQueryResponse which contains the response headers and lists of resource records. |
Remarks
To query specific servers can be useful in cases where you have to use a different DNS server than initially configured (without creating a new instance of ILookupClient for example).
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | If the |
ArgumentNullException | If |
DnsResponseException | After retries and fallbacks, if none of the servers were accessible, timed out or (if ThrowDnsErrors is enabled) returned error results. |
QueryServer(IReadOnlyCollection<NameServer>, DnsQuestion, DnsQueryOptions)
Performs a DNS lookup for the given question
using only the passed in servers
.
Declaration
public IDnsQueryResponse QueryServer(IReadOnlyCollection<NameServer> servers, DnsQuestion question, DnsQueryOptions queryOptions)
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyCollection<NameServer> | servers | The list of one or more server(s) which should be used for the lookup. |
DnsQuestion | question | The domain name query. |
DnsQueryOptions | queryOptions | Query options to be used instead of LookupClient's settings. |
Returns
Type | Description |
---|---|
IDnsQueryResponse | The IDnsQueryResponse which contains the response headers and lists of resource records. |
Remarks
To query specific servers can be useful in cases where you have to use a different DNS server than initially configured (without creating a new instance of ILookupClient for example).
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | If the |
ArgumentNullException | If |
DnsResponseException | After retries and fallbacks, if none of the servers were accessible, timed out or (if ThrowDnsErrors is enabled) returned error results. |
QueryServer(IReadOnlyCollection<NameServer>, String, QueryType, QueryClass)
Performs a DNS lookup for the given query
, queryType
and queryClass
using only the passed in servers
.
Declaration
public IDnsQueryResponse QueryServer(IReadOnlyCollection<NameServer> servers, string query, QueryType queryType, QueryClass queryClass = QueryClass.IN)
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyCollection<NameServer> | servers | The list of one or more server(s) which should be used for the lookup. |
String | query | The domain name query. |
QueryType | queryType | The QueryType. |
QueryClass | queryClass | The QueryClass. |
Returns
Type | Description |
---|---|
IDnsQueryResponse | The IDnsQueryResponse which contains the response headers and lists of resource records. |
Remarks
To query specific servers can be useful in cases where you have to use a different DNS server than initially configured (without creating a new instance of ILookupClient for example).
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | If the |
ArgumentNullException | If |
DnsResponseException | After retries and fallbacks, if none of the servers were accessible, timed out or (if ThrowDnsErrors is enabled) returned error results. |
QueryServer(IReadOnlyCollection<IPAddress>, String, QueryType, QueryClass)
Performs a DNS lookup for the given query
, queryType
and queryClass
using only the passed in servers
.
Declaration
public IDnsQueryResponse QueryServer(IReadOnlyCollection<IPAddress> servers, string query, QueryType queryType, QueryClass queryClass = QueryClass.IN)
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyCollection<IPAddress> | servers | The list of one or more server(s) which should be used for the lookup. |
String | query | The domain name query. |
QueryType | queryType | The QueryType. |
QueryClass | queryClass | The QueryClass. |
Returns
Type | Description |
---|---|
IDnsQueryResponse | The IDnsQueryResponse which contains the response headers and lists of resource records. |
Remarks
To query specific servers can be useful in cases where you have to use a different DNS server than initially configured (without creating a new instance of ILookupClient for example).
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | If the |
ArgumentNullException | If |
DnsResponseException | After retries and fallbacks, if none of the servers were accessible, timed out or (if ThrowDnsErrors is enabled) returned error results. |
QueryServer(IReadOnlyCollection<IPEndPoint>, String, QueryType, QueryClass)
Performs a DNS lookup for the given query
, queryType
and queryClass
using only the passed in servers
.
Declaration
public IDnsQueryResponse QueryServer(IReadOnlyCollection<IPEndPoint> servers, string query, QueryType queryType, QueryClass queryClass = QueryClass.IN)
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyCollection<IPEndPoint> | servers | The list of one or more server(s) which should be used for the lookup. |
String | query | The domain name query. |
QueryType | queryType | The QueryType. |
QueryClass | queryClass | The QueryClass. |
Returns
Type | Description |
---|---|
IDnsQueryResponse | The IDnsQueryResponse which contains the response headers and lists of resource records. |
Remarks
To query specific servers can be useful in cases where you have to use a different DNS server than initially configured (without creating a new instance of ILookupClient for example).
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | If the |
ArgumentNullException | If |
DnsResponseException | After retries and fallbacks, if none of the servers were accessible, timed out or (if ThrowDnsErrors is enabled) returned error results. |
QueryServerAsync(IReadOnlyCollection<NameServer>, DnsQuestion, DnsQueryOptions, CancellationToken)
Performs a DNS lookup for the given question
using only the passed in servers
.
Declaration
public Task<IDnsQueryResponse> QueryServerAsync(IReadOnlyCollection<NameServer> servers, DnsQuestion question, DnsQueryOptions queryOptions, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyCollection<NameServer> | servers | The list of one or more server(s) which should be used for the lookup. |
DnsQuestion | question | The domain name query. |
DnsQueryOptions | queryOptions | Query options to be used instead of LookupClient's settings. |
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task<IDnsQueryResponse> | The IDnsQueryResponse which contains the response headers and lists of resource records. |
Remarks
To query specific servers can be useful in cases where you have to use a different DNS server than initially configured (without creating a new instance of ILookupClient for example).
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | If the |
ArgumentNullException | If |
DnsResponseException | After retries and fallbacks, if none of the servers were accessible, timed out or (if ThrowDnsErrors is enabled) returned error results. |
QueryServerAsync(IReadOnlyCollection<NameServer>, DnsQuestion, CancellationToken)
Performs a DNS lookup for the given question
using only the passed in servers
.
Declaration
public Task<IDnsQueryResponse> QueryServerAsync(IReadOnlyCollection<NameServer> servers, DnsQuestion question, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyCollection<NameServer> | servers | The list of one or more server(s) which should be used for the lookup. |
DnsQuestion | question | The domain name query. |
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task<IDnsQueryResponse> | The IDnsQueryResponse which contains the response headers and lists of resource records. |
Remarks
To query specific servers can be useful in cases where you have to use a different DNS server than initially configured (without creating a new instance of ILookupClient for example).
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | If the |
ArgumentNullException | If |
DnsResponseException | After retries and fallbacks, if none of the servers were accessible, timed out or (if ThrowDnsErrors is enabled) returned error results. |
QueryServerAsync(IReadOnlyCollection<NameServer>, String, QueryType, QueryClass, CancellationToken)
Performs a DNS lookup for the given query
, queryType
and queryClass
using only the passed in servers
.
Declaration
public Task<IDnsQueryResponse> QueryServerAsync(IReadOnlyCollection<NameServer> servers, string query, QueryType queryType, QueryClass queryClass = QueryClass.IN, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyCollection<NameServer> | servers | The list of one or more server(s) which should be used for the lookup. |
String | query | The domain name query. |
QueryType | queryType | The QueryType. |
QueryClass | queryClass | The QueryClass. |
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task<IDnsQueryResponse> | The IDnsQueryResponse which contains the response headers and lists of resource records. |
Remarks
To query specific servers can be useful in cases where you have to use a different DNS server than initially configured (without creating a new instance of ILookupClient for example).
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | If the |
ArgumentNullException | If |
OperationCanceledException | If cancellation has been requested for the passed in |
DnsResponseException | After retries and fallbacks, if none of the servers were accessible, timed out or (if ThrowDnsErrors is enabled) returned error results. |
QueryServerAsync(IReadOnlyCollection<IPAddress>, String, QueryType, QueryClass, CancellationToken)
Performs a DNS lookup for the given query
, queryType
and queryClass
using only the passed in servers
.
Declaration
public Task<IDnsQueryResponse> QueryServerAsync(IReadOnlyCollection<IPAddress> servers, string query, QueryType queryType, QueryClass queryClass = QueryClass.IN, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyCollection<IPAddress> | servers | The list of one or more server(s) which should be used for the lookup. |
String | query | The domain name query. |
QueryType | queryType | The QueryType. |
QueryClass | queryClass | The QueryClass. |
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task<IDnsQueryResponse> | The IDnsQueryResponse which contains the response headers and lists of resource records. |
Remarks
To query specific servers can be useful in cases where you have to use a different DNS server than initially configured (without creating a new instance of ILookupClient for example).
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | If the |
ArgumentNullException | If |
OperationCanceledException | If cancellation has been requested for the passed in |
DnsResponseException | After retries and fallbacks, if none of the servers were accessible, timed out or (if ThrowDnsErrors is enabled) returned error results. |
QueryServerAsync(IReadOnlyCollection<IPEndPoint>, String, QueryType, QueryClass, CancellationToken)
Performs a DNS lookup for the given query
, queryType
and queryClass
using only the passed in servers
.
Declaration
public Task<IDnsQueryResponse> QueryServerAsync(IReadOnlyCollection<IPEndPoint> servers, string query, QueryType queryType, QueryClass queryClass = QueryClass.IN, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyCollection<IPEndPoint> | servers | The list of one or more server(s) which should be used for the lookup. |
String | query | The domain name query. |
QueryType | queryType | The QueryType. |
QueryClass | queryClass | The QueryClass. |
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task<IDnsQueryResponse> | The IDnsQueryResponse which contains the response headers and lists of resource records. |
Remarks
To query specific servers can be useful in cases where you have to use a different DNS server than initially configured (without creating a new instance of ILookupClient for example).
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | If the |
ArgumentNullException | If |
OperationCanceledException | If cancellation has been requested for the passed in |
DnsResponseException | After retries and fallbacks, if none of the servers were accessible, timed out or (if ThrowDnsErrors is enabled) returned error results. |
QueryServerReverse(IReadOnlyCollection<NameServer>, IPAddress)
Does a reverse lookup for the ipAddress
using only the passed in servers
.
Declaration
public IDnsQueryResponse QueryServerReverse(IReadOnlyCollection<NameServer> servers, IPAddress ipAddress)
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyCollection<NameServer> | servers | The list of one or more server(s) which should be used for the lookup. |
IPAddress | ipAddress | The IPAddress. |
Returns
Type | Description |
---|---|
IDnsQueryResponse | The IDnsQueryResponse which might contain the PtrRecord for the |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | If the |
ArgumentNullException | If |
DnsResponseException | After retries and fallbacks, if none of the servers were accessible, timed out or (if ThrowDnsErrors is enabled) returned error results. |
QueryServerReverse(IReadOnlyCollection<NameServer>, IPAddress, DnsQueryOptions)
Does a reverse lookup for the ipAddress
using only the passed in servers
.
Declaration
public IDnsQueryResponse QueryServerReverse(IReadOnlyCollection<NameServer> servers, IPAddress ipAddress, DnsQueryOptions queryOptions)
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyCollection<NameServer> | servers | The list of one or more server(s) which should be used for the lookup. |
IPAddress | ipAddress | The IPAddress. |
DnsQueryOptions | queryOptions | Query options to be used instead of LookupClient's settings. |
Returns
Type | Description |
---|---|
IDnsQueryResponse | The IDnsQueryResponse which might contain the PtrRecord for the |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | If the |
ArgumentNullException | If |
DnsResponseException | After retries and fallbacks, if none of the servers were accessible, timed out or (if ThrowDnsErrors is enabled) returned error results. |
QueryServerReverse(IReadOnlyCollection<IPAddress>, IPAddress)
Does a reverse lookup for the ipAddress
using only the passed in servers
.
Declaration
public IDnsQueryResponse QueryServerReverse(IReadOnlyCollection<IPAddress> servers, IPAddress ipAddress)
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyCollection<IPAddress> | servers | The list of one or more server(s) which should be used for the lookup. |
IPAddress | ipAddress | The IPAddress. |
Returns
Type | Description |
---|---|
IDnsQueryResponse | The IDnsQueryResponse which might contain the PtrRecord for the |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | If the |
ArgumentNullException | If |
DnsResponseException | After retries and fallbacks, if none of the servers were accessible, timed out or (if ThrowDnsErrors is enabled) returned error results. |
QueryServerReverse(IReadOnlyCollection<IPEndPoint>, IPAddress)
Does a reverse lookup for the ipAddress
using only the passed in servers
.
Declaration
public IDnsQueryResponse QueryServerReverse(IReadOnlyCollection<IPEndPoint> servers, IPAddress ipAddress)
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyCollection<IPEndPoint> | servers | The list of one or more server(s) which should be used for the lookup. |
IPAddress | ipAddress | The IPAddress. |
Returns
Type | Description |
---|---|
IDnsQueryResponse | The IDnsQueryResponse which might contain the PtrRecord for the |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | If the |
ArgumentNullException | If |
DnsResponseException | After retries and fallbacks, if none of the servers were accessible, timed out or (if ThrowDnsErrors is enabled) returned error results. |
QueryServerReverseAsync(IReadOnlyCollection<NameServer>, IPAddress, DnsQueryOptions, CancellationToken)
Does a reverse lookup for the ipAddress
using only the passed in servers
.
Declaration
public Task<IDnsQueryResponse> QueryServerReverseAsync(IReadOnlyCollection<NameServer> servers, IPAddress ipAddress, DnsQueryOptions queryOptions, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyCollection<NameServer> | servers | The list of one or more server(s) which should be used for the lookup. |
IPAddress | ipAddress | The IPAddress. |
DnsQueryOptions | queryOptions | Query options to be used instead of LookupClient's settings. |
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task<IDnsQueryResponse> | The IDnsQueryResponse which might contain the PtrRecord for the |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | If the |
ArgumentNullException | If |
OperationCanceledException | If cancellation has been requested for the passed in |
DnsResponseException | After retries and fallbacks, if none of the servers were accessible, timed out or (if ThrowDnsErrors is enabled) returned error results. |
QueryServerReverseAsync(IReadOnlyCollection<NameServer>, IPAddress, CancellationToken)
Does a reverse lookup for the ipAddress
using only the passed in servers
.
Declaration
public Task<IDnsQueryResponse> QueryServerReverseAsync(IReadOnlyCollection<NameServer> servers, IPAddress ipAddress, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyCollection<NameServer> | servers | The list of one or more server(s) which should be used for the lookup. |
IPAddress | ipAddress | The IPAddress. |
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task<IDnsQueryResponse> | The IDnsQueryResponse which might contain the PtrRecord for the |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | If the |
ArgumentNullException | If |
OperationCanceledException | If cancellation has been requested for the passed in |
DnsResponseException | After retries and fallbacks, if none of the servers were accessible, timed out or (if ThrowDnsErrors is enabled) returned error results. |
QueryServerReverseAsync(IReadOnlyCollection<IPAddress>, IPAddress, CancellationToken)
Does a reverse lookup for the ipAddress
using only the passed in servers
.
Declaration
public Task<IDnsQueryResponse> QueryServerReverseAsync(IReadOnlyCollection<IPAddress> servers, IPAddress ipAddress, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyCollection<IPAddress> | servers | The list of one or more server(s) which should be used for the lookup. |
IPAddress | ipAddress | The IPAddress. |
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task<IDnsQueryResponse> | The IDnsQueryResponse which might contain the PtrRecord for the |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | If the |
ArgumentNullException | If |
OperationCanceledException | If cancellation has been requested for the passed in |
DnsResponseException | After retries and fallbacks, if none of the servers were accessible, timed out or (if ThrowDnsErrors is enabled) returned error results. |
QueryServerReverseAsync(IReadOnlyCollection<IPEndPoint>, IPAddress, CancellationToken)
Does a reverse lookup for the ipAddress
using only the passed in servers
.
Declaration
public Task<IDnsQueryResponse> QueryServerReverseAsync(IReadOnlyCollection<IPEndPoint> servers, IPAddress ipAddress, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyCollection<IPEndPoint> | servers | The list of one or more server(s) which should be used for the lookup. |
IPAddress | ipAddress | The IPAddress. |
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task<IDnsQueryResponse> | The IDnsQueryResponse which might contain the PtrRecord for the |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | If the |
ArgumentNullException | If |
OperationCanceledException | If cancellation has been requested for the passed in |
DnsResponseException | After retries and fallbacks, if none of the servers were accessible, timed out or (if ThrowDnsErrors is enabled) returned error results. |