feat(dns): Support TXT query type (#1679)
Allows monitoring of things like spf records and others. Co-authored-by: TwiN <twin@linux.com>
This commit is contained in:
1 parent
809e5068d7
commit
08895200bb
2 files changed
+19
-2
No files matched your search
@@ -499,6 +499,13 @@ func QueryDNS(queryType, queryName, url string) (connected bool, dnsRcode string
|
||||
if srv, ok := rr.(*dns.SRV); ok {
|
||||
body = []byte(fmt.Sprintf("%s:%d", srv.Target, srv.Port))
|
||||
}
|
||||
case dns.TypeTXT:
|
||||
if txt, ok := rr.(*dns.TXT); ok {
|
||||
if len(body) > 0 {
|
||||
body = append(body, '\n')
|
||||
}
|
||||
body = append(body, []byte(strings.Join(txt.Txt, ""))...)
|
||||
}
|
||||
default:
|
||||
body = []byte("query type is not supported yet")
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user