fix: Incorrect query type in JSON

pull/2/head
Karan Sharma 2020-12-14 11:49:54 +05:30
parent 94b9c6be15
commit 61e92a7ccc
3 changed files with 7 additions and 6 deletions

View File

@ -1,4 +1,4 @@
DOGGO-BIN := doggo.bin
DOGGO-BIN := doggo
HASH := $(shell git rev-parse --short HEAD)
BUILD_DATE := $(shell date '+%Y-%m-%d %H:%M:%S')

View File

@ -8,7 +8,7 @@ import (
// AppHelpTemplate is the text template to customise the Help output.
// Uses text/template to render templates.
var AppHelpTemplate = `NAME:
{{.Name}} {{.Description}}
🐶 {{.Name}} - {{.Description}}
USAGE:
{{.Name}} [OPTIONS] [--] <arguments>

View File

@ -41,9 +41,10 @@ func (hub *Hub) outputJSON(out []Output, msgs []resolvers.Response) {
// get the questions
queries := make([]Query, 0, len(msgs))
for _, ques := range hub.Questions {
fmt.Println(ques.Qtype)
q := Query{
Name: ques.Name,
Type: dns.ClassToString[ques.Qtype],
Type: dns.TypeToString[ques.Qtype],
Class: dns.ClassToString[ques.Qclass],
}
queries = append(queries, q)
@ -100,7 +101,7 @@ func (hub *Hub) outputTerminal(out []Output) {
case "AAAA":
typOut = blue(o.Type)
case "MX":
typOut = cyan(o.Type)
typOut = red(o.Type)
case "NS":
typOut = cyan(o.Type)
case "CNAME":
@ -108,7 +109,7 @@ func (hub *Hub) outputTerminal(out []Output) {
case "TXT":
typOut = yellow(o.Type)
default:
typOut = red(o.Type)
typOut = blue(o.Type)
}
output := []string{green(o.Name), typOut, o.Class, o.TTL, o.Address, o.Nameserver}
// Print how long it took
@ -163,7 +164,7 @@ func collectOutput(responses []resolvers.Response) []Output {
case *dns.TXT:
addr = t.String()
case *dns.NS:
addr = t.String()
addr = t.Ns
case *dns.MX:
addr = strconv.Itoa(int(t.Preference)) + " " + t.Mx
case *dns.SOA: