projectdiscovery/retryabledns

Client.Resolve() does not fill DNSData.TTL of result (it's always 0)

fvbommel opened this issue · 1 comments

retryabledns version:

v1.0.21

Current Behavior:

After a successful call to (c *Client) Resolve(host), the A and AAAA fields of the first result are filled, but the TTL field is not, it is always 0.

Expected Behavior:

After a successful query, the TTL should be minimum TTL returned by any successful subquery. This should rarely, if ever, be 0.

Steps To Reproduce:

package main

import (
	"fmt"
	"log"

	"github.com/projectdiscovery/retryabledns"
)

func main() {
	resolvers := []string{"8.8.8.8:53", "8.8.4.4:53"}
	retries := 2
	hostname := "hackerone.com"
	dnsClient, err := retryabledns.New(resolvers, retries)
	if err != nil {
		log.Fatal(err)
	}

	ips, err := dnsClient.Resolve(hostname)
	if err != nil {
		log.Fatal(err)
	}

	fmt.Println("A:\t", ips.A)
	fmt.Println("AAAA:\t", ips.AAAA)
	fmt.Println("TTL:\t", ips.TTL)
}

Assuming no errors occur, this should print IP addresses and a non-zero TTL. Instead, an example output is the following:

A:       [104.16.100.52 104.16.99.52]
AAAA:    [2606:4700::6810:6434 2606:4700::6810:6334]
TTL:     0

Anything else:

No, that about sums it up.

@fvbommel thanks for reporting this, it's now fixed with #117