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] Take multiple transport options and initialise resolvers accordingly.
- [x] Add timeout support
- [x] Support SOA/NXDOMAIN
## CLI Features
- [x] `ndots` support
@ -36,7 +37,7 @@
- [x] Add client transport options
- [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`
- [ ] Flags - Remove uneeded ones
## Refactors
- [ ] 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)
case "TXT":
typOut = yellow(o.Type)
case "SOA":
typOut = red(o.Type)
default:
typOut = blue(o.Type)
}
@ -140,9 +142,18 @@ func collectOutput(responses [][]resolvers.Response) []Output {
var addr string
if r.Message.Rcode != dns.RcodeSuccess {
for _, ns := range r.Message.Ns {
blah, ok := ns.(*dns.SOA)
fmt.Println(blah, ok)
blah.String()
// check for SOA record
soa, ok := ns.(*dns.SOA)
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()
name := h.Name
qclass := dns.Class(h.Class).String()