using System; namespace DnsClient.Protocol { /* * RFC 7553 https://tools.ietf.org/html/rfc7553 4.5. URI RDATA Wire Format The RDATA for a URI RR consists of a 2-octet Priority field, a 2-octet Weight field, and a variable-length Target field. Priority and Weight are unsigned integers in network byte order. The remaining data in the RDATA contains the Target field. The Target field contains the URI as a sequence of octets (without the enclosing double-quote characters used in the presentation format). The length of the Target field MUST be greater than zero. 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Priority | Weight | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ / / / Target / / / +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ /// /// A represending a Uniform Resource Identifier (URI) resource. /// /// RFC 7553 public class UriRecord : DnsResourceRecord { /// /// Gets or sets the target Uri. /// /// /// The target. /// public string Target { get; set; } /// /// Gets or sets the priority. /// /// /// The priority. /// public int Priority { get; set; } /// /// Gets or sets the weigth. /// /// /// The weigth. /// public int Weigth { get; set; } /// /// Initializes a new instance of the class. /// /// The information. /// The priority. /// The weight. /// The target. /// If or is null. public UriRecord(ResourceRecordInfo info, ushort priority, ushort weight, string target) : base(info) { Target = target ?? throw new ArgumentNullException(nameof(target)); Priority = priority; Weigth = weight; } private protected override string RecordToString() { return $"{Priority} {Weigth} \"{Target}\""; } } }