author | Alberto Bertogli
<albertito@blitiri.com.ar> 2016-05-29 21:04:23 UTC |
committer | Alberto Bertogli
<albertito@blitiri.com.ar> 2016-05-29 21:09:34 UTC |
parent | 45365baa5a9aa19dc6702a6357679d7ffcccb2ea |
internal/dnstox/resolver.go | +10 | -5 |
diff --git a/internal/dnstox/resolver.go b/internal/dnstox/resolver.go index a90326b..367f6cd 100644 --- a/internal/dnstox/resolver.go +++ b/internal/dnstox/resolver.go @@ -227,6 +227,10 @@ func (r *httpsResolver) Query(req *dns.Msg, tr trace.Trace) (*dns.Msg, error) { return nil, fmt.Errorf("Failed to unmarshall: %v", err) } + if len(jr.Question) != 1 { + return nil, fmt.Errorf("Wrong number of questions in the response") + } + // Build the DNS response. resp := &dns.Msg{ MsgHdr: dns.MsgHdr{ @@ -241,13 +245,14 @@ func (r *httpsResolver) Query(req *dns.Msg, tr trace.Trace) (*dns.Msg, error) { AuthenticatedData: jr.AD, CheckingDisabled: jr.CD, }, + Question: []dns.Question{ + dns.Question{ + Name: jr.Question[0].Name, + Qtype: jr.Question[0].Type, + Qclass: dns.ClassINET, + }}, } - if len(jr.Question) != 1 { - return nil, fmt.Errorf("Wrong number of questions in the response") - } - resp.SetQuestion(jr.Question[0].Name, jr.Question[0].Type) - for _, answer := range jr.Answer { // TODO: This "works" but is quite hacky. Is there a better way, // without doing lots of data parsing?