From b392a1e8fff5a6dae3a1f1619a1865fc7b24f0cd Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 9 Jun 2022 13:59:50 +0200 Subject: [PATCH] Add geoip.IsInitialized to expose if the databases have been loaded --- intel/geoip/lookup.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/intel/geoip/lookup.go b/intel/geoip/lookup.go index 7210bc79..c635b574 100644 --- a/intel/geoip/lookup.go +++ b/intel/geoip/lookup.go @@ -26,3 +26,8 @@ func GetLocation(ip net.IP) (*Location, error) { record.FillMissingInfo() return record, nil } + +// IsInitialized returns whether the geoip database has been initialized. +func IsInitialized(v6, wait bool) bool { + return worker.GetReader(v6, wait) != nil +}