internal/clientinfo: use ptr cache when listing clients

This commit is contained in:
Cuong Manh Le
2023-08-09 23:55:29 +07:00
committed by Cuong Manh Le
parent 39a2cab051
commit 6e27f877ff
3 changed files with 16 additions and 1 deletions
+7
View File
@@ -40,6 +40,13 @@ func (p *ptrDiscover) String() string {
return "ptr"
}
func (p *ptrDiscover) lookupHostnameFromCache(ip string) string {
if val, ok := p.hostname.Load(ip); ok {
return val.(string)
}
return ""
}
func (p *ptrDiscover) lookupHostname(ip string) string {
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()