/// <summary> /// simple method to get the bytes from a given DnsResourceRecord /// </summary> /// <param name="record">DnsResourceRecord instance</param> /// <returns>byte[] representation the DnsResourceRecord instance</returns> protected byte[] GetBytesFromRecord(DnsResourceRecord record) { DnsBuffer buff = new DnsBuffer(); record.Serialize(buff); return(buff.Buffer); }
public DnsRecord[] GetMatchingDnsRecords(string domainName, Health.Direct.Common.DnsResolver.DnsStandard.RecordType typeID) { DnsRecord[] records = Store.DnsRecords.Get(domainName, typeID); if (!records.IsNullOrEmpty()) { return(records); } // For NS and SOA records, check if we own the question domain. if (typeID == DnsStandard.RecordType.SOA || typeID == DnsStandard.RecordType.NS) { string owningDomain = QuestionDomainToOwnedDomain(domainName); if (owningDomain == null) { return(null); } records = Store.DnsRecords.Get(owningDomain, typeID); // apply the question's domain before returning the records. foreach (DnsRecord record in records) { DnsResourceRecord newRecord = record.Deserialize(); newRecord.Name = domainName; record.DomainName = domainName; record.RecordData = newRecord.Serialize(); } } return(records); }