/// <summary> /// processes a SRV Question, populated the response with any matching results pulled from the database store /// </summary> /// <param name="response">DnsResponse instance containing information about the question that will /// have any corresponding answer records populated upon return</param> protected void ProcessSRVQuestion(DnsResponse response) { using (RecordRetrievalServiceClient client = m_recordRetrievalServiceSettings.CreateRecordRetrievalClient()) { client.GetSRVRecords(response.Question.Domain, response.AnswerRecords); } }
/// <summary> /// processes a CERT Question, populated the response with any matching results pulled from the database store /// </summary> /// <param name="response">DnsResponse instance containing information about the question that will /// have any corresponding answer records populated upon return</param> void ProcessCERTQuestion(DnsResponse response) { using (RecordRetrievalServiceClient client = m_recordRetrievalServiceSettings.CreateRecordRetrievalClient()) { Certificate[] certs = client.GetCertificatesForOwner(response.Question.Domain); foreach (Certificate cert in certs) { response.AnswerRecords.Add(new CertRecord(new DnsX509Cert(cert.Data))); } } }
/// <summary> /// processes a ANAME Question, populated the response with any matching results pulled from the database store /// </summary> /// <param name="response">DnsResponse instance containing information about the question that will /// have any corresponding answer records populated upon return</param> protected void ProcessANAMEQuestion(DnsResponse response) { using (RecordRetrievalServiceClient client = m_recordRetrievalServiceSettings.CreateRecordRetrievalClient()) { client.GetANAMERecords(response.Question.Domain, response.AnswerRecords); if (!response.HasAnswerRecords) { client.GetCNAMERecords(response.Question.Domain, response.AnswerRecords); } } }
public static void GetMatches(this RecordRetrievalServiceClient client, string domain, DnsResourceRecordCollection resourceRecords, DnsStandard.RecordType recordType) { DnsRecord[] matches = client.GetMatchingDnsRecords(domain, recordType); if (matches.IsNullOrEmpty()) { return; } foreach (DnsRecord record in matches) { DnsResourceRecord responseRecord = record.Deserialize(); if (responseRecord != null && responseRecord.Type == recordType) { resourceRecords.Add(responseRecord); } } }
void ProcessNSQuestion(DnsResponse response) { using (RecordRetrievalServiceClient client = m_recordRetrievalServiceSettings.CreateRecordRetrievalClient()) { client.GetNSRecords(response.Question.Domain, response.AnswerRecords); if (!response.HasAnswerRecords) { return; } // // Also resolve the NS Record's actual address, to save roundtrips // foreach (NSRecord record in response.AnswerRecords.NS) { client.GetANAMERecords(record.NameServer, response.AdditionalRecords); } } }
/// <summary> /// processes a MX Question, populated the response with any matching results pulled from the database store /// </summary> /// <param name="response">DnsResponse instance containing information about the question that will /// have any corresponding answer records populated upon return</param> protected void ProcessMXQuestion(DnsResponse response) { using (RecordRetrievalServiceClient client = m_recordRetrievalServiceSettings.CreateRecordRetrievalClient()) { client.GetMXRecords(response.Question.Domain, response.AnswerRecords); if (!response.HasAnswerRecords) { return; } // // additionally return each MX record's IP address // foreach (MXRecord mxRecord in response.AnswerRecords.MX) { client.GetANAMERecords(mxRecord.Exchange, response.AdditionalRecords); } } }
public static void GetNSRecords(this RecordRetrievalServiceClient client, string domain, DnsResourceRecordCollection recordCollection) { client.GetMatches(domain, recordCollection, DnsStandard.RecordType.NS); }