start the series of fix() checks

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-01-06 02:48:46 -06:00
parent 01eca8fc10
commit d2fb88cd58
2 changed files with 29 additions and 5 deletions

17
gui.go
View File

@ -209,6 +209,23 @@ func mainWindow(title string) {
// This is where you figure out what to do next to fix the problems // This is where you figure out what to do next to fix the problems
gr.NewButton("fix", func () { gr.NewButton("fix", func () {
if ! me.status.Ready() {
log.Warn("The IPv6 Control Panel is not Ready() yet")
return
}
if me.status.ValidHostname() {
log.Warn("Your hostname is VALID:", me.status.GetHostname())
} else {
log.Warn("You must first fix your hostname:", me.status.GetHostname())
return
}
if ! me.status.IPv4() {
log.Warn("You do not have real IPv4 addresses. Nothing to fix here")
}
if ! me.status.IPv6() {
log.Warn("IPv6 DNS is broken. Check what is broken here")
return
}
log.Warn("FIGURE OUT WHAT TO DO HERE") log.Warn("FIGURE OUT WHAT TO DO HERE")
}) })

View File

@ -16,7 +16,6 @@ import (
"go.wit.com/log" "go.wit.com/log"
"go.wit.com/gui/gui" "go.wit.com/gui/gui"
"go.wit.com/gui/gadgets" "go.wit.com/gui/gadgets"
"go.wit.com/gui/cloudflare"
) )
type hostnameStatus struct { type hostnameStatus struct {
@ -51,8 +50,8 @@ type hostnameStatus struct {
speedActual *gadgets.OneLiner speedActual *gadgets.OneLiner
// Actions // Actions
dnsValue *gui.Node // dnsValue *gui.Node
dnsAction *gui.Node // dnsAction *gui.Node
} }
func NewHostnameStatusWindow(p *gui.Node) *hostnameStatus { func NewHostnameStatusWindow(p *gui.Node) *hostnameStatus {
@ -95,6 +94,7 @@ func NewHostnameStatusWindow(p *gui.Node) *hostnameStatus {
group.Pad() group.Pad()
grid.Pad() grid.Pad()
/*
group = hs.window.Box().NewGroup("Actions") group = hs.window.Box().NewGroup("Actions")
grid = group.NewGrid("LookupDetails", 2, 2) grid = group.NewGrid("LookupDetails", 2, 2)
@ -108,6 +108,7 @@ func NewHostnameStatusWindow(p *gui.Node) *hostnameStatus {
hs.createDNSrecord(hs.dnsValue.S) hs.createDNSrecord(hs.dnsValue.S)
} }
}) })
*/
group.Pad() group.Pad()
grid.Pad() grid.Pad()
@ -146,6 +147,7 @@ func (hs *hostnameStatus) API() string {
return hs.dnsAPI.Get() return hs.dnsAPI.Get()
} }
/*
func (hs *hostnameStatus) deleteDNSrecord(value string) bool { func (hs *hostnameStatus) deleteDNSrecord(value string) bool {
log.Info("deleteDNSrecord() START for", value) log.Info("deleteDNSrecord() START for", value)
log.Info("deleteDNSrecord() hostname =", me.status.GetHostname()) log.Info("deleteDNSrecord() hostname =", me.status.GetHostname())
@ -171,6 +173,7 @@ func (hs *hostnameStatus) createDNSrecord(value string) bool {
} }
return false return false
} }
*/
func (hs *hostnameStatus) Update() { func (hs *hostnameStatus) Update() {
log.Info("hostnameStatus() Update() START") log.Info("hostnameStatus() Update() START")
@ -266,6 +269,7 @@ func (hs *hostnameStatus) existsAAAA(s string) bool {
return false return false
} }
/*
// figure out if I'm missing any IPv6 address in DNS // figure out if I'm missing any IPv6 address in DNS
func (hs *hostnameStatus) missingAAAA() bool { func (hs *hostnameStatus) missingAAAA() bool {
var aaaa []string var aaaa []string
@ -284,6 +288,7 @@ func (hs *hostnameStatus) missingAAAA() bool {
return false return false
} }
*/
func (hs *hostnameStatus) updateStatus() { func (hs *hostnameStatus) updateStatus() {
if ! hs.Ready() { return } if ! hs.Ready() { return }
@ -302,15 +307,17 @@ func (hs *hostnameStatus) updateStatus() {
s = "(none)" s = "(none)"
} else { } else {
hs.setIPv6("Check for real IPv6 addresses here") hs.setIPv6("Check for real IPv6 addresses here")
/*
if hs.missingAAAA() { if hs.missingAAAA() {
hs.setIPv6("Add the missing IPv6 address") hs.setIPv6("Add the missing IPv6 address")
} }
*/
for _, addr := range vals { for _, addr := range vals {
log.Log(STATUS, addr) log.Log(STATUS, addr)
s += addr + " (DELETE)" + "\n" s += addr + " (DELETE)" + "\n"
hs.setIPv6("NEEDS DELETE") hs.setIPv6("NEEDS DELETE")
hs.dnsValue.SetText(addr) // hs.dnsValue.SetText(addr)
hs.dnsAction.SetText("DELETE") // hs.dnsAction.SetText("DELETE")
} }
} }
hs.set(hs.dnsAAAA, s) hs.set(hs.dnsAAAA, s)