rrda

REST API allowing to perform DNS queries over HTTP
Log | Files | Refs | README | LICENSE

commit fd9848ecbd4ff64d11bf50eaf681c99731d7ab7d
parent de0eb89f62f57a51bc78cb28d59f18063a5eb48d
Author: Frederic Cambus <fred@statdns.com>
Date:   Tue, 10 Jan 2023 12:33:33 +0100

Refactor the resolve function to allow passing a DNS class parameter.

Diffstat:
Mrrda.go | 8+++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/rrda.go b/rrda.go @@ -101,10 +101,12 @@ func jsonify(w http.ResponseWriter, r *http.Request, question []dns.Question, an } // Perform DNS resolution -func resolve(w http.ResponseWriter, r *http.Request, server string, domain string, querytype uint16) { +func resolve(w http.ResponseWriter, r *http.Request, server string, domain string, querytype uint16, class uint16) { m := new(dns.Msg) - m.SetQuestion(domain, querytype) - m.MsgHdr.RecursionDesired = true + m.Id = dns.Id() + m.RecursionDesired = true + m.Question = make([]dns.Question, 1) + m.Question[0] = dns.Question{domain, querytype, class} w.Header().Set("Content-Type", "application/json") w.Header().Set("Access-Control-Allow-Origin", "*")