Use IP resolve log

This commit is contained in:
2018-07-07 13:17:30 +09:00
parent e46c9b1586
commit 25b7e39d75
2 changed files with 16 additions and 18 deletions

View File

@ -10,7 +10,7 @@ import (
var ipToHosts = cache.New(60*time.Minute, 30*time.Minute)
// GetHostsForIP returns all host names for the given IP (if cached).
func GetHostsForIP(ip string) []string {
func GetHostsForIP(ip string) ([]string, bool) {
hosts, found := ipToHosts.Get(ip)
if !found {
@ -18,10 +18,10 @@ func GetHostsForIP(ip string) []string {
}
if hosts == nil {
return nil
return nil, found
}
return hosts.([]string)
return hosts.([]string), found
}
// Finds all host names for the given IP