From f0fae0c756b746624a5a1679db88bf7f0f569ea3 Mon Sep 17 00:00:00 2001 From: Markus Linnala Date: Thu, 3 Oct 2019 19:43:27 +0300 Subject: [PATCH] cleanup: xtransport: There is no function level foundIP in resolveUsingResolver Rename foundIPx to foundIP just to make it nicer looking. --- dnscrypt-proxy/xtransport.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/dnscrypt-proxy/xtransport.go b/dnscrypt-proxy/xtransport.go index 072851ef..6a1786da 100644 --- a/dnscrypt-proxy/xtransport.go +++ b/dnscrypt-proxy/xtransport.go @@ -154,7 +154,6 @@ func (xTransport *XTransport) resolveUsingSystem(host string) (*string, error) { } func (xTransport *XTransport) resolveUsingResolver(dnsClient *dns.Client, host string, resolver string) (*string, error) { - var foundIP *string var err error if xTransport.useIPv4 { msg := new(dns.Msg) @@ -165,13 +164,13 @@ func (xTransport *XTransport) resolveUsingResolver(dnsClient *dns.Client, host s if err == nil { for _, answer := range in.Answer { if answer.Header().Rrtype == dns.TypeA { - foundIPx := answer.(*dns.A).A.String() - return &foundIPx, nil + foundIP := answer.(*dns.A).A.String() + return &foundIP, nil } } } } - if xTransport.useIPv6 && foundIP == nil { + if xTransport.useIPv6 { msg := new(dns.Msg) msg.SetQuestion(dns.Fqdn(host), dns.TypeAAAA) msg.SetEdns0(4096, true) @@ -180,8 +179,8 @@ func (xTransport *XTransport) resolveUsingResolver(dnsClient *dns.Client, host s if err == nil { for _, answer := range in.Answer { if answer.Header().Rrtype == dns.TypeAAAA { - foundIPx := "[" + answer.(*dns.AAAA).AAAA.String() + "]" - return &foundIPx, nil + foundIP := "[" + answer.(*dns.AAAA).AAAA.String() + "]" + return &foundIP, nil } } }