diff --git a/pkg/query/util.go b/pkg/query/util.go index 393fae6..a8c07a2 100644 --- a/pkg/query/util.go +++ b/pkg/query/util.go @@ -12,13 +12,13 @@ import ( "golang.org/x/net/idna" ) -var ( - ttl any - name string - err error -) - func (message *Message) displayQuestion(msg *dns.Msg, opts *util.Options, opt *dns.OPT) error { + + var ( + name string + err error + ) + for _, question := range msg.Question { if opts.Display.UcodeTranslate { name, err = idna.ToUnicode(question.Name) @@ -40,6 +40,13 @@ func (message *Message) displayQuestion(msg *dns.Msg, opts *util.Options, opt *d } func (message *Message) displayAnswers(msg *dns.Msg, opts *util.Options, opt *dns.OPT) error { + + var ( + ttl any + name string + err error + ) + for _, answer := range msg.Answer { temp := strings.Split(answer.String(), "\t") @@ -77,6 +84,13 @@ func (message *Message) displayAnswers(msg *dns.Msg, opts *util.Options, opt *dn } func (message *Message) displayAuthority(msg *dns.Msg, opts *util.Options, opt *dns.OPT) error { + + var ( + ttl any + name string + err error + ) + for _, ns := range msg.Ns { temp := strings.Split(ns.String(), "\t") @@ -114,6 +128,13 @@ func (message *Message) displayAuthority(msg *dns.Msg, opts *util.Options, opt * } func (message *Message) displayAdditional(msg *dns.Msg, opts *util.Options, opt *dns.OPT) error { + + var ( + ttl any + name string + err error + ) + for _, additional := range msg.Extra { if additional.Header().Rrtype == dns.StringToType["OPT"] { continue