mirror of
https://github.com/TwiN/gatus.git
synced 2024-12-22 14:41:01 +01:00
feat(client): Add support for PTR DNS records (#886)
Co-authored-by: TwiN <twin@linux.com>
This commit is contained in:
parent
2fe991319e
commit
29cbff6774
@ -321,6 +321,10 @@ func QueryDNS(queryType, queryName, url string) (connected bool, dnsRcode string
|
|||||||
if ns, ok := rr.(*dns.NS); ok {
|
if ns, ok := rr.(*dns.NS); ok {
|
||||||
body = []byte(ns.Ns)
|
body = []byte(ns.Ns)
|
||||||
}
|
}
|
||||||
|
case dns.TypePTR:
|
||||||
|
if ptr, ok := rr.(*dns.PTR); ok {
|
||||||
|
body = []byte(ptr.Ptr)
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
body = []byte("query type is not supported yet")
|
body = []byte("query type is not supported yet")
|
||||||
}
|
}
|
||||||
|
@ -396,6 +396,16 @@ func TestQueryDNS(t *testing.T) {
|
|||||||
expectedDNSCode: "NOERROR",
|
expectedDNSCode: "NOERROR",
|
||||||
expectedBody: "*.iana-servers.net.",
|
expectedBody: "*.iana-servers.net.",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "test Config with type PTR",
|
||||||
|
inputDNS: dns.Config{
|
||||||
|
QueryType: "PTR",
|
||||||
|
QueryName: "8.8.8.8.in-addr.arpa.",
|
||||||
|
},
|
||||||
|
inputURL: "8.8.8.8",
|
||||||
|
expectedDNSCode: "NOERROR",
|
||||||
|
expectedBody: "dns.google.",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "test Config with fake type and retrieve error",
|
name: "test Config with fake type and retrieve error",
|
||||||
inputDNS: dns.Config{
|
inputDNS: dns.Config{
|
||||||
|
Loading…
Reference in New Issue
Block a user