From 53fbb4cb85ffe7be05aedfcb40a17bf8d15560ad Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sat, 6 Jan 2024 19:00:51 -0600 Subject: [PATCH] ready to compare host and dns AAAA values Signed-off-by: Jeff Carr --- fix.go | 15 +++++++++++++-- hostnameStatus.go | 5 +++++ linuxstatus/hostname.go | 6 ++++++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/fix.go b/fix.go index d2cd76c..40179c5 100644 --- a/fix.go +++ b/fix.go @@ -35,10 +35,21 @@ func fix() bool { } if ! me.status.IPv6() { log.Warn("IPv6 DNS is broken. Check what is broken here") - log.Warn("What are my IPv6 addresses?") - log.Warn("What are the AAAA resource records in DNS?") + fixIPv6dns() return false } log.Warn("YOU SHOULD BE IN IPv6 BLISS") return true } + +func fixIPv6dns() { + log.Warn("What are my IPv6 addresses?") + for _, aaaa := range me.statusOS.GetIPv6os() { + log.Warn("FOUND AAAA ip", aaaa) + } + + log.Warn("What are the AAAA resource records in DNS?") + for _, aaaa := range me.status.GetIPv6dns() { + log.Warn("FOUND AAAA ip", aaaa) + } +} diff --git a/hostnameStatus.go b/hostnameStatus.go index 327a900..4701b33 100644 --- a/hostnameStatus.go +++ b/hostnameStatus.go @@ -279,6 +279,11 @@ func (hs *hostnameStatus) missingAAAA() bool { } */ +func (hs *hostnameStatus) GetIPv6dns() []string { + tmp := hs.dnsAAAA.Get() + return strings.Split(tmp, "\n") +} + func (hs *hostnameStatus) updateStatus() { if ! hs.Ready() { return } var s string diff --git a/linuxstatus/hostname.go b/linuxstatus/hostname.go index e9ac5f4..63ab817 100644 --- a/linuxstatus/hostname.go +++ b/linuxstatus/hostname.go @@ -3,6 +3,7 @@ package linuxstatus import ( + "strings" "go.wit.com/log" "go.wit.com/shell" @@ -64,6 +65,11 @@ func (ls *LinuxStatus) setHostShort() { } } +func (ls *LinuxStatus) GetIPv6os() []string { + tmp := me.workingIPv6.Get() + return strings.Split(tmp, "\n") +} + func lookupHostname() { if ! me.Ready() {return} var err error