Class DnsString
The DnsString type is used to normalize and validate domain names and labels.
Type to normalize domain names used in query and returned results.
When used as query input, the parsing will check for certain DNS domain name rules.
The type implicitly converts back to string.
Inherited Members
Namespace: DnsClient
Assembly: DnsClient.dll
Syntax
public class DnsString
Fields
| Improve this Doc View SourceACEPrefix
The ACE prefix indicates that the domain name label contains not normally supported characters and that the label has been endoded.
Declaration
public const string ACEPrefix = "xn--"
Field Value
Type | Description |
---|---|
String |
LabelMaxLength
The maximum lenght in bytes for one label.
Declaration
public const int LabelMaxLength = 63
Field Value
Type | Description |
---|---|
Int32 |
QueryMaxLength
The maximum supported total length in bytes for a domain nanme. The calculation of the actual bytes this DnsString consumes includes all bytes used for to encode it as octet string.
Declaration
public const int QueryMaxLength = 255
Field Value
Type | Description |
---|---|
Int32 |
RootLabel
The root label ".".
Declaration
public static readonly DnsString RootLabel
Field Value
Type | Description |
---|---|
DnsString |
Properties
| Improve this Doc View SourceOriginal
Gets the orginal value.
Declaration
public string Original { get; }
Property Value
Type | Description |
---|---|
String |
Value
Gets the validated and eventually modified value.
Declaration
public string Value { get; }
Property Value
Type | Description |
---|---|
String |
Methods
| Improve this Doc View SourceEquals(Object)
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
Object | obj |
Returns
Type | Description |
---|---|
Boolean |
Overrides
| Improve this Doc View SourceFromResponseQueryString(String)
Transforms names with the ACEPrefix to the unicode variant and adds a trailing '.' at the end if not present. The original value will be kept in this instance in case it is needed.
Declaration
public static DnsString FromResponseQueryString(string query)
Parameters
Type | Name | Description |
---|---|---|
String | query | The value to check. |
Returns
Type | Description |
---|---|
DnsString | The DnsString representation. |
Remarks
The method does not parse the domain name unless it contains a ACEPrefix.
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 |
Overrides
| Improve this Doc View SourceParse(String)
Parses the given query
and validates all labels.
Declaration
public static DnsString Parse(string query)
Parameters
Type | Name | Description |
---|---|---|
String | query | A domain name. |
Returns
Type | Description |
---|---|
DnsString | The DnsString representing the given |
Remarks
An empty string will be interpreted as root label.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | If |
ToString()
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
String |
Overrides
Operators
| Improve this Doc View SourceImplicit(DnsString to String)
Declaration
public static implicit operator string (DnsString name)
Parameters
Type | Name | Description |
---|---|---|
DnsString | name | The name. |
Returns
Type | Description |
---|---|
String | The result of the conversion. |