1
0
mirror of https://github.com/DNSCrypt/dnscrypt-proxy.git synced 2024-12-29 00:30:30 +01:00

cleanup: xtransport: There is no function level foundIP in resolveUsingResolver

Rename foundIPx to foundIP just to make it nicer looking.
This commit is contained in:
Markus Linnala 2019-10-03 19:43:27 +03:00 committed by Frank Denis
parent 80fa99877f
commit f0fae0c756

View File

@ -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
}
}
}