Class DnsQueryOptions
The options used to override the defaults of LookupClient per query.
Inherited Members
Namespace: DnsClient
Assembly: DnsClient.dll
Syntax
public class DnsQueryOptions
Fields
| Improve this Doc View SourceMaximumBufferSize
The maximum reasonable payload size.
Declaration
public const int MaximumBufferSize = 4096
Field Value
Type | Description |
---|---|
Int32 |
MinimumBufferSize
The minimum payload size. Anything equal or less than that will default back to this value and might disable EDNS.
Declaration
public const int MinimumBufferSize = 512
Field Value
Type | Description |
---|---|
Int32 |
Properties
| Improve this Doc View SourceContinueOnDnsError
Gets or sets 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; set; }
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; set; }
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 or sets a flag indicating whether each IDnsQueryResponse will contain a full documentation of the response(s).
Default is False
.
Declaration
public bool EnableAuditTrail { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
See Also
| Improve this Doc View SourceExtendedDnsBufferSize
Gets or sets 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; set; }
Property Value
Type | Description |
---|---|
Int32 |
Recursion
Gets or sets 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; set; }
Property Value
Type | Description |
---|---|
Boolean | The flag indicating if recursion should be used or not. |
RequestDnsSecRecords
Gets or sets a flag indicating whether EDNS should be enabled and the DO
flag should be set.
Defaults to False
.
Declaration
public bool RequestDnsSecRecords { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
Retries
Gets or sets 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 2
which will be three tries total.
If all configured NameServers error out after retries, an exception will be thrown at the end.
Declaration
public int Retries { get; set; }
Property Value
Type | Description |
---|---|
Int32 | The number of retries. |
ThrowDnsErrors
Gets or sets 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; set; }
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 or sets 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; set; }
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 or sets 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; set; }
Property Value
Type | Description |
---|---|
Boolean |
Remarks
In case the DNS Server returns records with a TTL of zero. The response cannot be cached.
UseRandomNameServer
Gets or sets 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; set; }
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 or sets 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; set; }
Property Value
Type | Description |
---|---|
Boolean |
UseTcpOnly
Gets or sets 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; set; }
Property Value
Type | Description |
---|---|
Boolean |
Operators
| Improve this Doc View SourceImplicit(DnsQueryOptions to DnsQuerySettings)
Converts the query options into readonly settings.
Declaration
public static implicit operator DnsQuerySettings(DnsQueryOptions fromOptions)
Parameters
Type | Name | Description |
---|---|---|
DnsQueryOptions | fromOptions | The options. |
Returns
Type | Description |
---|---|
DnsQuerySettings |