- DNS: filtering didn't work

This commit is contained in:
Simon Zolin
2020-03-24 11:30:22 +03:00
parent 06b3378fd7
commit c16dc6cf62
2 changed files with 12 additions and 4 deletions

View File

@@ -225,11 +225,15 @@ func (a *AutoHosts) update() {
}
// Process - get the list of IP addresses for the hostname
// Return nil if not found
func (a *AutoHosts) Process(host string) []net.IP {
var ipsCopy []net.IP
a.lock.Lock()
ips, _ := a.table[host]
ipsCopy := make([]net.IP, len(ips))
copy(ipsCopy, ips)
if len(ips) != 0 {
ipsCopy = make([]net.IP, len(ips))
copy(ipsCopy, ips)
}
a.lock.Unlock()
return ipsCopy
}