feat: Support SOA

pull/2/head
Karan Sharma 2020-12-16 18:50:25 +05:30
parent 53e7f2e59c
commit 7e3f1c3cdd
2 changed files with 16 additions and 4 deletions

View File

@ -15,6 +15,7 @@
- [x] Support multiple resolvers - [x] Support multiple resolvers
- [x] Take multiple transport options and initialise resolvers accordingly. - [x] Take multiple transport options and initialise resolvers accordingly.
- [x] Add timeout support - [x] Add timeout support
- [x] Support SOA/NXDOMAIN
## CLI Features ## CLI Features
- [x] `ndots` support - [x] `ndots` support
@ -36,7 +37,7 @@
- [x] Add client transport options - [x] Add client transport options
- [x] Fix an issue while loading free form args, where the same records are being added twice - [x] Fix an issue while loading free form args, where the same records are being added twice
- [x] Remove urfave/cli in favour of `pflag + koanf` - [x] Remove urfave/cli in favour of `pflag + koanf`
- [ ] Flags - Remove uneeded ones
## Refactors ## Refactors
- [ ] Don't abuse Hub as global. Refactor methods to be independent of hub. - [ ] Don't abuse Hub as global. Refactor methods to be independent of hub.

View File

@ -107,6 +107,8 @@ func (hub *Hub) outputTerminal(out []Output) {
typOut = yellow(o.Type) typOut = yellow(o.Type)
case "TXT": case "TXT":
typOut = yellow(o.Type) typOut = yellow(o.Type)
case "SOA":
typOut = red(o.Type)
default: default:
typOut = blue(o.Type) typOut = blue(o.Type)
} }
@ -140,9 +142,18 @@ func collectOutput(responses [][]resolvers.Response) []Output {
var addr string var addr string
if r.Message.Rcode != dns.RcodeSuccess { if r.Message.Rcode != dns.RcodeSuccess {
for _, ns := range r.Message.Ns { for _, ns := range r.Message.Ns {
blah, ok := ns.(*dns.SOA) // check for SOA record
fmt.Println(blah, ok) soa, ok := ns.(*dns.SOA)
blah.String() if !ok {
// skip this message
continue
}
addr = soa.Ns + " " + soa.Mbox +
" " + strconv.FormatInt(int64(soa.Serial), 10) +
" " + strconv.FormatInt(int64(soa.Refresh), 10) +
" " + strconv.FormatInt(int64(soa.Retry), 10) +
" " + strconv.FormatInt(int64(soa.Expire), 10) +
" " + strconv.FormatInt(int64(soa.Minttl), 10)
h := ns.Header() h := ns.Header()
name := h.Name name := h.Name
qclass := dns.Class(h.Class).String() qclass := dns.Class(h.Class).String()