From b3f9ad42629209331e8bc9442f1642f7a3bf1579 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sun, 7 Jan 2024 08:26:53 -0600 Subject: [PATCH] more housecleaning Signed-off-by: Jeff Carr --- digStatus.go | 5 +++-- fix.go | 10 +++++++++- gui.go | 16 ++++++---------- linuxstatus/update.go | 4 ++-- structs.go | 2 -- 5 files changed, 20 insertions(+), 17 deletions(-) diff --git a/digStatus.go b/digStatus.go index af72227..fd775af 100644 --- a/digStatus.go +++ b/digStatus.go @@ -16,7 +16,6 @@ import ( "os" "fmt" "time" - "strings" "reflect" "errors" @@ -153,6 +152,7 @@ func (ds *digStatus) setIPv6status(s string) { me.digStatus.set(ds.statusAAAA, s) } +/* func (ds *digStatus) SetIPv6(s string) { if ! ds.Ready() {return} log.Warn("Should SetIPv6() here to", s) @@ -162,6 +162,7 @@ func (ds *digStatus) SetIPv6(s string) { me.DnsAAAA.Set(s) // me.digStatus.set(ds.httpGoWitCom, addr) } +*/ func (ds *digStatus) set(a any, s string) { if ! ds.Ready() {return} @@ -301,7 +302,7 @@ func (ds *digStatus) checkLookupDoH(hostname string) bool { s = append(s, addr) status = true } - me.digStatus.SetIPv6(strings.Join(s, "\n")) + // me.digStatus.SetIPv6(strings.Join(s, "\n")) return status } diff --git a/fix.go b/fix.go index dc50f65..27444f3 100644 --- a/fix.go +++ b/fix.go @@ -65,7 +65,7 @@ func fixIPv6dns() bool { // remove old DNS entries first for aaaa, _ := range dnsAAAA { - if osAAAA[aaaa] == "dns" { + if osAAAA[aaaa] == "os" { broken = true log.Log(INFO, "DNS AAAA is not in OS", aaaa) addToFixWindow("DELETE", aaaa) @@ -128,14 +128,22 @@ func exists(m map[string]bool, s string) bool { } func addToFixWindow(t string, ip string) { + log.Log(WARN, "addToFixWindow() START") if me.fixWindow == nil { + log.Log(WARN, "addToFixWindow() START") + log.Log(WARN, "addToFixWindow() START") + log.Log(WARN, "addToFixWindow() START") + log.Log(WARN, "addToFixWindow() START") me.fixWindow = smartwindow.New() me.fixWindow.SetParent(me.myGui) me.fixWindow.InitWindow() me.fixWindow.Title("fix window") me.fixWindow.SetDraw(drawFixWindow) me.fixWindow.Make() + me.fixWindow.Draw() + // me.fixWindow.Draw2() } + log.Log(WARN, "addToFixWindow() END") } func drawFixWindow(sw *smartwindow.SmartWindow) { diff --git a/gui.go b/gui.go index 8e5b639..3505608 100644 --- a/gui.go +++ b/gui.go @@ -4,8 +4,6 @@ package main import ( "time" "os" - "strings" - "sort" "go.wit.com/log" @@ -60,6 +58,7 @@ func debugTab(title string) { me.debug.Hide() } +/* // doesn't actually do any network traffic // it just updates the GUI func displayDNS() string { @@ -95,6 +94,7 @@ func displayDNS() string { } return broken } +*/ func myDefaultExit(n *gui.Node) { log.Println("You can Do exit() things here") @@ -110,10 +110,6 @@ func mainWindow(title string) { grid.SetNext(1,1) me.hostname = gadgets.NewOneLiner(grid, "hostname =").Set("unknown") - me.DnsAAAA = gadgets.NewOneLiner(grid, "DNS AAAA =").Set("unknown") - - grid.NewLabel("DNS A =") - me.DnsA = grid.NewLabel("?") // This is where you figure out what to do next to fix the problems me.fixButton = gr.NewButton("fix", func () { @@ -127,7 +123,7 @@ func mainWindow(title string) { me.hostname.Set(hostname) me.hostnameStatus.Set("WORKING") me.DnsStatus.Set("WORKING") - me.fixButton.Disable() + // me.fixButton.Disable() }) grid.Margin() @@ -216,7 +212,7 @@ func updateDNS() { // log.Println(SPEW, me) if (aaaa == nil) { log.Warn("There are no DNS AAAA records for hostname: ", h) - me.DnsAAAA.Set("(none)") + // me.DnsAAAA.Set("(none)") if (cloudflare.CFdialog.TypeNode != nil) { cloudflare.CFdialog.TypeNode.SetText("AAAA new") } @@ -251,8 +247,8 @@ func updateDNS() { // } } } - status := displayDNS() // update the GUI based on dig results - me.DnsStatus.SetText(status) + // status := displayDNS() // update the GUI based on dig results + // me.DnsStatus.SetText(status) if me.digStatus.Ready() { if me.digStatus.IPv6() { diff --git a/linuxstatus/update.go b/linuxstatus/update.go index 686d799..b304370 100644 --- a/linuxstatus/update.go +++ b/linuxstatus/update.go @@ -18,11 +18,11 @@ func (ls *LinuxStatus) Update() { duration := timeFunction(func () { linuxLoop() }) - ls.SetSpeed(duration) + ls.setSpeed(duration) log.Log(INFO, "Update() END") } -func (ls *LinuxStatus) SetSpeed(duration time.Duration) { +func (ls *LinuxStatus) setSpeed(duration time.Duration) { s := fmt.Sprint(duration) if ls.speedActual == nil { log.Log(WARN, "can't actually warn") diff --git a/structs.go b/structs.go index f7f6411..061eb09 100644 --- a/structs.go +++ b/structs.go @@ -50,8 +50,6 @@ type Host struct { // DNS stuff DnsAPI *gui.Node // what DNS API to use? - DnsAAAA *gadgets.OneLiner // the actual DNS AAAA results - DnsA *gui.Node // the actual DNS A results (ignore for status since mostly never happens?) DnsStatus *gui.Node // the current state of DNS DnsSpeed *gui.Node // 'FAST', 'OK', 'SLOW', etc DnsSpeedActual *gui.Node // the last actual duration