feat(client): Add support for PTR DNS records

This commit is contained in:
Martin Stone 2024-11-02 19:37:08 +00:00
parent 1c78f659c2
commit 0f5f997b04
No known key found for this signature in database
GPG Key ID: EFCCE8CE3493314B
2 changed files with 14 additions and 0 deletions

View File

@ -332,6 +332,10 @@ func QueryDNS(queryType, queryName, url string) (connected bool, dnsRcode string
if ns, ok := rr.(*dns.NS); ok {
body = []byte(ns.Ns)
}
case dns.TypePTR:
if ptr, ok := rr.(*dns.PTR); ok {
body = []byte(ptr.Ptr)
}
default:
body = []byte("query type is not supported yet")
}

View File

@ -396,6 +396,16 @@ func TestQueryDNS(t *testing.T) {
expectedDNSCode: "NOERROR",
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",
inputDNS: dns.Config{