From 203653871513a6ae3fb6144592be0fe3b2dc7af9 Mon Sep 17 00:00:00 2001 From: lordwelch Date: Tue, 7 Apr 2020 02:06:06 -0700 Subject: [PATCH] Add IP type checks --- pkg/sync/ipaddress.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/sync/ipaddress.go b/pkg/sync/ipaddress.go index fe3eb56..1a98734 100644 --- a/pkg/sync/ipaddress.go +++ b/pkg/sync/ipaddress.go @@ -74,7 +74,13 @@ func (i *IPAddressPoller) poll() error { if err != nil { return fmt.Errorf("could not obtain IP address: %w", err) } - log.Printf("Found IP %v", ip) + if ip.To4() != nil && i.iptype == 6 { + return nil + } + if ip.To4() == nil && i.iptype == 4 { + return nil + } + log.Printf("Found IP %v %v", ip, len(ip)) for _, c := range i.channels { select { case c <- ip.String():