Domain Detective

API Reference

Struct

DnsAnswer

Namespace DnsClientX
Assembly DnsClientX
Base ValueType
Modifiers sealed

Represents a DNS resource record returned by the server. See RFC 1035 for the resource record format.

Inheritance

  • ValueType
  • DnsAnswer

Usage

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

Accepted by parameters

Constructors

public DnsAnswer() #

Initializes a new instance of the DnsAnswer struct.

Methods

CleanupTxtRecordData(System.String data) #

Centralized cleanup method for TXT record data to ensure consistency across all DNS providers. Removes empty lines, trims whitespace, and normalizes line endings.

Parameters

data System.String required
The TXT record data to clean up

Returns

Cleaned TXT record data

ConvertData() #

Converts the data to a string trying to unify the format of the data between different providers

Returns

Record data converted to a unified string format.

ConvertToMultiString() #

Converts the raw data to multiple strings. By default, DNS records are stored as a single string. Some records (mainly TXT) can be split into multiple strings and maximum length of a string is 255 characters. This method tries to preserve the original format of the data in case user needs to check for that format.

Returns

Array of strings representing record data.

CountOccurrences(System.String text, System.String pattern) #

Counts occurrences of a substring in a string

Parameters

text System.String required
The text to search in
pattern System.String required
The pattern to search for

Returns

Number of occurrences

HasObviousConcatenation(System.String data) #

More aggressive detection for obvious concatenation patterns

Parameters

data System.String required
The cleaned TXT record data

Returns

True if obvious concatenation is detected

IsConcatenatedTxtRecord(System.String data) #

Determines if a TXT record appears to be concatenated based on common patterns

Parameters

data System.String required
The cleaned TXT record data

Returns

True if the record appears to be concatenated

NormalizeLineEndings(System.String data) #

Normalizes line endings to '\n' regardless of the original platform.

Parameters

data System.String required
Input string

Returns

String with '\n' line endings

ParseNaptrRDataAndFormat(System.Byte[] rdata) #

Converts a special format like "\u0003one\u0003one\u0003one\u0003one\0" to a standard dotted format.

Parameters

rdata System.Byte[] required
The raw data in special format.

Returns

The data in standard dotted format.

SetFilteredData(System.String filteredData) #

Sets filtered data that will override the normal ConvertData() behavior. This is used internally for filtering operations. Not thread-safe; callers should ensure they operate on a local copy of the struct, not shared across threads.

Parameters

filteredData System.String required
The filtered data to return from the Data property.
SplitByEqualsPattern(System.String data) #

Splits concatenated records by analyzing equals sign patterns

Parameters

data System.String required
The concatenated data

Returns

List of potential record segments

SplitConcatenatedTxtRecord(System.String data) #

Splits concatenated TXT records into separate lines

Parameters

data System.String required
The concatenated TXT record data

Returns

Properly separated TXT records

Properties

public String Name { get; set; } #
JsonPropertyName("name")

This is the name of the record. Removes the trailing dot if it exists to make it easier to compare with other records across providers.

public DnsRecordType Type { get; set; } #
JsonPropertyName("type")

The type of DNS record.

public Int32 TTL { get; set; } #
JsonPropertyName("TTL")

The number of seconds for TTL (time to live) for the record.

public String DataRaw { get; set; } #
JsonPropertyName("data")

The raw value of the DNS record for the given name and type as received from the server. The data will be in text for standardized record types and in HEX for unknown types.

public String Data { get; } #
JsonIgnore

the value of the DNS record for the given name and type after being processed and converted to a string.

public String[] DataStrings { get; } #
JsonIgnore

The value of the DNS record for the given name and type, split into multiple strings if necessary. Tries to preserve the original format of the data.

public Object TypedRecord { get; } #
JsonIgnore

Returns the record parsed into a typed representation when supported.

public String[] DataStringsEscaped { get; } #
JsonIgnore

The value of the DNS record for the given name and type, escaped if necessary removing the quotes completely.

Fields

public String OriginalName #
JsonIgnore

This is the name of the record. Retains original name as returned by the server.

_filteredData #

Temporary storage for filtered data that overrides the normal ConvertData() behavior.

{{ include "footer" }}