From 6fe7900221f6ed38a67d7ce90331987eb9d4b60e Mon Sep 17 00:00:00 2001 From: Artem Glazychev Date: Wed, 27 Jul 2022 18:19:32 +0700 Subject: [PATCH] Fix getDNSServerIP function Signed-off-by: Artem Glazychev --- main.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index b261615..6312b9a 100644 --- a/main.go +++ b/main.go @@ -213,8 +213,12 @@ func main() { logrus.SetFormatter(&nested.Formatter{}) var dnsServerIP = new(atomic.Value) - dnsServerIP.Store(net.IP(nil)) - config.getDNSServerIP = func() net.IP { return dnsServerIP.Load().(net.IP) } + config.getDNSServerIP = func() net.IP { + if ip := dnsServerIP.Load(); ip != nil { + return ip.(net.IP) + } + return nil + } // ******************************************************************************** // Configure Open Telemetry