Class DnsQuerySettings
The options used to override the defaults of LookupClient per query.
Implements
Inherited Members
Namespace: DnsClient
Assembly: DnsClient.dll
Syntax
public class DnsQuerySettings : IEquatable<DnsQuerySettings>
Constructors
| Improve this Doc View SourceDnsQuerySettings(DnsQueryOptions)
Creates a new instance of DnsQueryAndServerSettings.
Declaration
public DnsQuerySettings(DnsQueryOptions options)
Parameters
Type | Name | Description |
---|---|---|
DnsQueryOptions | options |
Properties
| Improve this Doc View SourceContinueOnDnsError
Gets a flag indicating whether to query the next configured NameServers in case the response of the last query
returned a DnsResponseCode other than NoError.
Default is True
.
Declaration
public bool ContinueOnDnsError { get; }
Property Value
Type | Description |
---|---|
Boolean |
Remarks
If True
, lookup client will continue until a server returns a valid result, or,
if no NameServers yield a valid result, the last response with the error will be returned.
In case no server yields a valid result and ThrowDnsErrors is also enabled, an exception
will be thrown containing the error of the last response.
If True
and ThrowDnsErrors is enabled, the exception will be thrown on first encounter without trying any other servers.
See Also
| Improve this Doc View SourceContinueOnEmptyResponse
Gets or sets a flag indicating whether to query the next configured NameServers
if the response does not have an error DnsResponseCode but the query was not answered by the response.
Default is True
.
Declaration
public bool ContinueOnEmptyResponse { get; }
Property Value
Type | Description |
---|---|
Boolean |
Remarks
The query is answered if there is at least one DnsResourceRecord in the answers section matching the DnsQuestion's QueryType.
If there are zero answers in the response, the query is not answered, independent of the QueryType. If there are answers in the response, the QueryType is used to find a matching record, query types ANY and AXFR will be ignored by this check.
EnableAuditTrail
Gets a flag indicating whether each IDnsQueryResponse will contain a full documentation of the response(s).
Default is False
.
Declaration
public bool EnableAuditTrail { get; }
Property Value
Type | Description |
---|---|
Boolean |
See Also
| Improve this Doc View SourceExtendedDnsBufferSize
Gets the maximum buffer used for UDP requests.
Defaults to 4096
.
If this value is less or equal to 512
bytes, EDNS might be disabled.
Declaration
public int ExtendedDnsBufferSize { get; }
Property Value
Type | Description |
---|---|
Int32 |
Recursion
Gets a flag indicating whether DNS queries should instruct the DNS server to do recursive lookups, or not.
Default is True
.
Declaration
public bool Recursion { get; }
Property Value
Type | Description |
---|---|
Boolean | The flag indicating if recursion should be used or not. |
RequestDnsSecRecords
Gets a flag indicating whether EDNS should be enabled and the DO
flag should be set.
Defaults to False
.
Declaration
public bool RequestDnsSecRecords { get; }
Property Value
Type | Description |
---|---|
Boolean |
Retries
Gets the number of tries to get a response from one name server before trying the next one.
Only transient errors, like network or connection errors will be retried.
Default is 5
.
If all configured NameServers error out after retries, an exception will be thrown at the end.
Declaration
public int Retries { get; }
Property Value
Type | Description |
---|---|
Int32 | The number of retries. |
ThrowDnsErrors
Gets a flag indicating whether the ILookupClient should throw a DnsResponseException
in case the query result has a DnsResponseCode other than NoError.
Default is False
.
Declaration
public bool ThrowDnsErrors { get; }
Property Value
Type | Description |
---|---|
Boolean |
Remarks
If set to False
, the query will return a result with an ErrorMessage
which contains more information.
If set to True
, any query method of IDnsQuery will throw an DnsResponseException if
the response header indicates an error.
If both, ContinueOnDnsError and ThrowDnsErrors are set to True
,
ILookupClient will continue to query all configured NameServers.
If none of the servers yield a valid response, a DnsResponseException will be thrown
with the error of the last response.
See Also
| Improve this Doc View SourceTimeout
Gets the request timeout in milliseconds. Timeout is used for limiting the connection and request time for one operation. Timeout must be greater than zero and less than MaxValue. If InfiniteTimeSpan (or -1) is used, no timeout will be applied. Default is 5 seconds.
Declaration
public TimeSpan Timeout { get; }
Property Value
Type | Description |
---|---|
TimeSpan |
Remarks
If a very short timeout is configured, queries will more likely result in TimeoutExceptions.
Important to note, TimeoutExceptions will be retried, if Retries are not disabled (set to 0
).
This should help in case one or more configured DNS servers are not reachable or under load for example.
UseCache
Gets a flag indicating whether DNS queries should use response caching or not.
The cache duration is calculated by the resource record of the response. Usually, the lowest TTL is used.
Default is True
.
Declaration
public bool UseCache { get; }
Property Value
Type | Description |
---|---|
Boolean |
Remarks
In case the DNS Server returns records with a TTL of zero. The response cannot be cached.
UseExtendedDns
Gets a flag indicating whether EDNS is enabled based on the values of ExtendedDnsBufferSize and RequestDnsSecRecords.
Declaration
public bool UseExtendedDns { get; }
Property Value
Type | Description |
---|---|
Boolean |
UseRandomNameServer
Gets a flag indicating whether the ILookupClient can cycle through all
configured NameServers on each consecutive request, basically using a random server, or not.
Default is True
.
If only one NameServer is configured, this setting is not used.
Declaration
public bool UseRandomNameServer { get; }
Property Value
Type | Description |
---|---|
Boolean |
Remarks
If False
, configured endpoint will be used in random order.
If True
, the order will be preserved.
Even if UseRandomNameServer is set to True
, the endpoint might still get
disabled and might not being used for some time if it errors out, e.g. no connection can be established.
UseTcpFallback
Gets a flag indicating whether Tcp should be used in case a Udp response is truncated.
Default is True
.
If False
, truncated results will potentially yield no or incomplete answers.
Declaration
public bool UseTcpFallback { get; }
Property Value
Type | Description |
---|---|
Boolean |
UseTcpOnly
Gets a flag indicating whether Udp should not be used at all.
Default is False
.
Enable this only if Udp cannot be used because of your firewall rules for example. Also, zone transfers (see AXFR) must use TCP only.
Declaration
public bool UseTcpOnly { get; }
Property Value
Type | Description |
---|---|
Boolean |
Methods
| Improve this Doc View SourceEquals(DnsQuerySettings)
Declaration
public bool Equals(DnsQuerySettings other)
Parameters
Type | Name | Description |
---|---|---|
DnsQuerySettings | other |
Returns
Type | Description |
---|---|
Boolean |
Equals(Object)
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
Object | obj |
Returns
Type | Description |
---|---|
Boolean |