From d61798f8cbe3281b78ad7a693152f41dab710cf1 Mon Sep 17 00:00:00 2001 From: Ice3man Date: Sun, 14 Mar 2021 00:58:18 +0530 Subject: [PATCH] Update client.go --- client.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/client.go b/client.go index 1c51942..1aaf47d 100644 --- a/client.go +++ b/client.go @@ -56,11 +56,14 @@ func (c *Client) Resolve(host string) (*DNSData, error) { // Do sends a provided dns request and return the raw native response func (c *Client) Do(msg *dns.Msg) (*dns.Msg, error) { + var resp *dns.Msg + var err error + for i := 0; i < c.maxRetries; i++ { index := atomic.AddUint32(&c.serversIndex, 1) resolver := c.resolvers[index%uint32(len(c.resolvers))] - resp, err := dns.Exchange(msg, resolver) + resp, err = dns.Exchange(msg, resolver) if err != nil || resp == nil { continue }