Skip to content

Commit

Permalink
chore: rename server addr function
Browse files Browse the repository at this point in the history
  • Loading branch information
Jake Gealer committed Mar 3, 2022
1 parent 0473695 commit 6389f89
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions backend/api_v1/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,15 +166,15 @@ func findNameserverHostname(log *zap.Logger, addr string, chunks []string) (stri
func doDnsLookups(log *zap.Logger, dnsServer, recordType string, recursive bool, chunks []string) (map[string][]*DNSResponse, error) {
// Resolve the IP of the DNS server.
var addr string
server2addr := func() error {
setServerAddr := func() error {
rawAddr, err := net.ResolveIPAddr("ip", dnsServer)
if err != nil {
return err
}
addr = rawAddr.IP.String() + ":53"
return nil
}
if err := server2addr(); err != nil {
if err := setServerAddr(); err != nil {
return nil, err
}

Expand All @@ -191,7 +191,7 @@ func doDnsLookups(log *zap.Logger, dnsServer, recordType string, recursive bool,
} else {
// Turn it into the address.
dnsServer = host
if err = server2addr(); err != nil {
if err = setServerAddr(); err != nil {
return nil, err
}
}
Expand All @@ -217,7 +217,7 @@ func doDnsLookups(log *zap.Logger, dnsServer, recordType string, recursive bool,
}

// Try to update the DNS server used here.
if err = server2addr(); err != nil {
if err = setServerAddr(); err != nil {
return nil, err
}

Expand Down

0 comments on commit 6389f89

Please sign in to comment.