more housecleaning
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
259b4bdb40
commit
b3f9ad4262
|
@ -16,7 +16,6 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
"strings"
|
|
||||||
"reflect"
|
"reflect"
|
||||||
"errors"
|
"errors"
|
||||||
|
|
||||||
|
@ -153,6 +152,7 @@ func (ds *digStatus) setIPv6status(s string) {
|
||||||
me.digStatus.set(ds.statusAAAA, s)
|
me.digStatus.set(ds.statusAAAA, s)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
func (ds *digStatus) SetIPv6(s string) {
|
func (ds *digStatus) SetIPv6(s string) {
|
||||||
if ! ds.Ready() {return}
|
if ! ds.Ready() {return}
|
||||||
log.Warn("Should SetIPv6() here to", s)
|
log.Warn("Should SetIPv6() here to", s)
|
||||||
|
@ -162,6 +162,7 @@ func (ds *digStatus) SetIPv6(s string) {
|
||||||
me.DnsAAAA.Set(s)
|
me.DnsAAAA.Set(s)
|
||||||
// me.digStatus.set(ds.httpGoWitCom, addr)
|
// me.digStatus.set(ds.httpGoWitCom, addr)
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
func (ds *digStatus) set(a any, s string) {
|
func (ds *digStatus) set(a any, s string) {
|
||||||
if ! ds.Ready() {return}
|
if ! ds.Ready() {return}
|
||||||
|
@ -301,7 +302,7 @@ func (ds *digStatus) checkLookupDoH(hostname string) bool {
|
||||||
s = append(s, addr)
|
s = append(s, addr)
|
||||||
status = true
|
status = true
|
||||||
}
|
}
|
||||||
me.digStatus.SetIPv6(strings.Join(s, "\n"))
|
// me.digStatus.SetIPv6(strings.Join(s, "\n"))
|
||||||
return status
|
return status
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
10
fix.go
10
fix.go
|
@ -65,7 +65,7 @@ func fixIPv6dns() bool {
|
||||||
|
|
||||||
// remove old DNS entries first
|
// remove old DNS entries first
|
||||||
for aaaa, _ := range dnsAAAA {
|
for aaaa, _ := range dnsAAAA {
|
||||||
if osAAAA[aaaa] == "dns" {
|
if osAAAA[aaaa] == "os" {
|
||||||
broken = true
|
broken = true
|
||||||
log.Log(INFO, "DNS AAAA is not in OS", aaaa)
|
log.Log(INFO, "DNS AAAA is not in OS", aaaa)
|
||||||
addToFixWindow("DELETE", aaaa)
|
addToFixWindow("DELETE", aaaa)
|
||||||
|
@ -128,14 +128,22 @@ func exists(m map[string]bool, s string) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
func addToFixWindow(t string, ip string) {
|
func addToFixWindow(t string, ip string) {
|
||||||
|
log.Log(WARN, "addToFixWindow() START")
|
||||||
if me.fixWindow == nil {
|
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 = smartwindow.New()
|
||||||
me.fixWindow.SetParent(me.myGui)
|
me.fixWindow.SetParent(me.myGui)
|
||||||
me.fixWindow.InitWindow()
|
me.fixWindow.InitWindow()
|
||||||
me.fixWindow.Title("fix window")
|
me.fixWindow.Title("fix window")
|
||||||
me.fixWindow.SetDraw(drawFixWindow)
|
me.fixWindow.SetDraw(drawFixWindow)
|
||||||
me.fixWindow.Make()
|
me.fixWindow.Make()
|
||||||
|
me.fixWindow.Draw()
|
||||||
|
// me.fixWindow.Draw2()
|
||||||
}
|
}
|
||||||
|
log.Log(WARN, "addToFixWindow() END")
|
||||||
}
|
}
|
||||||
|
|
||||||
func drawFixWindow(sw *smartwindow.SmartWindow) {
|
func drawFixWindow(sw *smartwindow.SmartWindow) {
|
||||||
|
|
16
gui.go
16
gui.go
|
@ -4,8 +4,6 @@ package main
|
||||||
import (
|
import (
|
||||||
"time"
|
"time"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
|
||||||
"sort"
|
|
||||||
|
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
|
|
||||||
|
@ -60,6 +58,7 @@ func debugTab(title string) {
|
||||||
me.debug.Hide()
|
me.debug.Hide()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
// doesn't actually do any network traffic
|
// doesn't actually do any network traffic
|
||||||
// it just updates the GUI
|
// it just updates the GUI
|
||||||
func displayDNS() string {
|
func displayDNS() string {
|
||||||
|
@ -95,6 +94,7 @@ func displayDNS() string {
|
||||||
}
|
}
|
||||||
return broken
|
return broken
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
func myDefaultExit(n *gui.Node) {
|
func myDefaultExit(n *gui.Node) {
|
||||||
log.Println("You can Do exit() things here")
|
log.Println("You can Do exit() things here")
|
||||||
|
@ -110,10 +110,6 @@ func mainWindow(title string) {
|
||||||
grid.SetNext(1,1)
|
grid.SetNext(1,1)
|
||||||
|
|
||||||
me.hostname = gadgets.NewOneLiner(grid, "hostname =").Set("unknown")
|
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
|
// This is where you figure out what to do next to fix the problems
|
||||||
me.fixButton = gr.NewButton("fix", func () {
|
me.fixButton = gr.NewButton("fix", func () {
|
||||||
|
@ -127,7 +123,7 @@ func mainWindow(title string) {
|
||||||
me.hostname.Set(hostname)
|
me.hostname.Set(hostname)
|
||||||
me.hostnameStatus.Set("WORKING")
|
me.hostnameStatus.Set("WORKING")
|
||||||
me.DnsStatus.Set("WORKING")
|
me.DnsStatus.Set("WORKING")
|
||||||
me.fixButton.Disable()
|
// me.fixButton.Disable()
|
||||||
})
|
})
|
||||||
|
|
||||||
grid.Margin()
|
grid.Margin()
|
||||||
|
@ -216,7 +212,7 @@ func updateDNS() {
|
||||||
// log.Println(SPEW, me)
|
// log.Println(SPEW, me)
|
||||||
if (aaaa == nil) {
|
if (aaaa == nil) {
|
||||||
log.Warn("There are no DNS AAAA records for hostname: ", h)
|
log.Warn("There are no DNS AAAA records for hostname: ", h)
|
||||||
me.DnsAAAA.Set("(none)")
|
// me.DnsAAAA.Set("(none)")
|
||||||
if (cloudflare.CFdialog.TypeNode != nil) {
|
if (cloudflare.CFdialog.TypeNode != nil) {
|
||||||
cloudflare.CFdialog.TypeNode.SetText("AAAA new")
|
cloudflare.CFdialog.TypeNode.SetText("AAAA new")
|
||||||
}
|
}
|
||||||
|
@ -251,8 +247,8 @@ func updateDNS() {
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
status := displayDNS() // update the GUI based on dig results
|
// status := displayDNS() // update the GUI based on dig results
|
||||||
me.DnsStatus.SetText(status)
|
// me.DnsStatus.SetText(status)
|
||||||
|
|
||||||
if me.digStatus.Ready() {
|
if me.digStatus.Ready() {
|
||||||
if me.digStatus.IPv6() {
|
if me.digStatus.IPv6() {
|
||||||
|
|
|
@ -18,11 +18,11 @@ func (ls *LinuxStatus) Update() {
|
||||||
duration := timeFunction(func () {
|
duration := timeFunction(func () {
|
||||||
linuxLoop()
|
linuxLoop()
|
||||||
})
|
})
|
||||||
ls.SetSpeed(duration)
|
ls.setSpeed(duration)
|
||||||
log.Log(INFO, "Update() END")
|
log.Log(INFO, "Update() END")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ls *LinuxStatus) SetSpeed(duration time.Duration) {
|
func (ls *LinuxStatus) setSpeed(duration time.Duration) {
|
||||||
s := fmt.Sprint(duration)
|
s := fmt.Sprint(duration)
|
||||||
if ls.speedActual == nil {
|
if ls.speedActual == nil {
|
||||||
log.Log(WARN, "can't actually warn")
|
log.Log(WARN, "can't actually warn")
|
||||||
|
|
|
@ -50,8 +50,6 @@ type Host struct {
|
||||||
|
|
||||||
// DNS stuff
|
// DNS stuff
|
||||||
DnsAPI *gui.Node // what DNS API to use?
|
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
|
DnsStatus *gui.Node // the current state of DNS
|
||||||
DnsSpeed *gui.Node // 'FAST', 'OK', 'SLOW', etc
|
DnsSpeed *gui.Node // 'FAST', 'OK', 'SLOW', etc
|
||||||
DnsSpeedActual *gui.Node // the last actual duration
|
DnsSpeedActual *gui.Node // the last actual duration
|
||||||
|
|
Loading…
Reference in New Issue