summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-01-06 02:21:56 -0600
committerJeff Carr <[email protected]>2024-01-06 02:21:56 -0600
commit01eca8fc107e287432e7f49752ad3c0932e2562b (patch)
tree2ae9f37d8ac6fd3d92457b374f8d41aee2f810ab
parentca3a01f478aa60fb039892d2cae6823188b5842c (diff)
all engines still firing
Signed-off-by: Jeff Carr <[email protected]>
-rw-r--r--gui.go51
-rw-r--r--hostname.go11
-rw-r--r--main.go16
-rw-r--r--structs.go18
4 files changed, 32 insertions, 64 deletions
diff --git a/gui.go b/gui.go
index 8aa3659..1c66100 100644
--- a/gui.go
+++ b/gui.go
@@ -101,6 +101,11 @@ func debugTab(title string) {
// log.Println(o)
})
+ g2.NewButton("getProcessNameByPort()", func () {
+ processName := getProcessNameByPort(53)
+ log.Info("Process with port 53:", processName)
+ })
+
g2 = me.debug.Box().NewGroup("debugging options")
// makes a slider widget
@@ -189,25 +194,22 @@ func myDefaultExit(n *gui.Node) {
func mainWindow(title string) {
me.window = gadgets.NewBasicWindow(me.myGui, title)
- me.mainStatus = me.window.Box().NewGroup("dns update")
- grid := me.mainStatus.NewGrid("gridnuts", 2, 2)
+ gr := me.window.Box().NewGroup("dns update")
+ grid := gr.NewGrid("gridnuts", 2, 2)
grid.SetNext(1,1)
grid.NewLabel("hostname =")
me.fqdn = grid.NewLabel("?")
- // grid.NewLabel("DNS AAAA =")
me.DnsAAAA = gadgets.NewOneLiner(grid, "DNS AAAA =").Set("unknown")
grid.NewLabel("DNS A =")
me.DnsA = grid.NewLabel("?")
- me.digStatus = NewDigStatusWindow(me.myGui)
- me.status = NewHostnameStatusWindow(me.myGui)
-
- me.hostnameStatusButton = me.mainStatus.NewButton("Fix hostname DNS", func () {
- me.status.window.Toggle()
+ // This is where you figure out what to do next to fix the problems
+ gr.NewButton("fix", func () {
+ log.Warn("FIGURE OUT WHAT TO DO HERE")
})
grid.Margin()
@@ -215,15 +217,23 @@ func mainWindow(title string) {
statusGrid(me.window.Box())
- gr := me.window.Box().NewGroup("debugging")
- gr.NewButton("OS Details", func () {
+ gr = me.window.Box().NewGroup("debugging")
+ gr.NewButton("hostname status", func () {
+ if ! me.status.Ready() {return}
+ me.status.window.Toggle()
+ })
+
+ gr.NewButton("OS details", func () {
me.details.Toggle()
})
- gr.NewButton("Resolver Status", func () {
+ gr.NewButton("resolver status", func () {
if ! me.digStatus.Ready() {return}
me.digStatus.window.Toggle()
})
- gr.NewButton("Control Panel Debug", func () {
+ gr.NewButton("cloudflare wit.com", func () {
+ cloudflare.CreateRR(me.myGui, "wit.com", "3777302ac4a78cd7fa4f6d3f72086d06")
+ })
+ gr.NewButton("Debug", func () {
me.debug.Toggle()
})
}
@@ -345,20 +355,3 @@ func updateDNS() {
log.Println("updateDNS() END")
}
-
-func suggestProcDebugging() {
- if (me.fixProc != nil) {
- // me.fixProc.Disable()
- return
- }
-
- me.fixProc = me.mainStatus.NewButton("Try debugging Slow DNS lookups", func () {
- log.Warn("You're DNS lookups are very slow")
- me.dbOn.Set(true)
- me.dbProc.Set(true)
-
- processName := getProcessNameByPort(53)
- log.Info("Process with port 53:", processName)
- })
- // me.fixProc.Disable()
-}
diff --git a/hostname.go b/hostname.go
index 10211ba..062f033 100644
--- a/hostname.go
+++ b/hostname.go
@@ -7,7 +7,7 @@ import (
"go.wit.com/log"
"go.wit.com/shell"
- "go.wit.com/gui/cloudflare"
+// "go.wit.com/gui/cloudflare"
"github.com/miekg/dns"
// will try to get this hosts FQDN
@@ -53,15 +53,6 @@ func getHostname() {
me.hostnameStatus.SetText("VALID")
me.changed = true
}
- // enable the cloudflare button if the provider is cloudflare
- if (me.cloudflareB == nil) {
- log.Log(CHANGE, "me.cloudflare == nil; me.DnsAPI.S =", me.DnsAPI.S)
- if (me.DnsAPI.S == "cloudflare") {
- me.cloudflareB = me.mainStatus.NewButton("cloudflare wit.com", func () {
- cloudflare.CreateRR(me.myGui, "wit.com", "3777302ac4a78cd7fa4f6d3f72086d06")
- })
- }
- }
}
}
diff --git a/main.go b/main.go
index 232204c..f417b86 100644
--- a/main.go
+++ b/main.go
@@ -44,6 +44,9 @@ func main() {
log.Sleep(me.artificialSleep)
setupControlPanelWindow()
+ me.digStatus = NewDigStatusWindow(me.myGui)
+ me.status = NewHostnameStatusWindow(me.myGui)
+
if debugger.ArgDebug() {
log.Sleep(2)
debugger.DebugWindow(me.myGui)
@@ -121,24 +124,15 @@ func DNSloop() {
log.Info("dnsTTL() execution Time: ", duration)
var s, newSpeed string
if (duration > 5000 * time.Millisecond ) {
- newSpeed = "VERY BAD"
- suggestProcDebugging()
+ newSpeed = "VERY SLOW"
} else if (duration > 2000 * time.Millisecond ) {
- newSpeed = "BAD"
- suggestProcDebugging()
+ newSpeed = "SLOWER"
} else if (duration > 500 * time.Millisecond ) {
- suggestProcDebugging()
newSpeed = "SLOW"
} else if (duration > 100 * time.Millisecond ) {
newSpeed = "OK"
- if (me.fixProc != nil) {
- // me.fixProc.Disable()
- }
} else {
newSpeed = "FAST"
- if (me.fixProc != nil) {
- // me.fixProc.Disable()
- }
}
if (newSpeed != me.DnsSpeedLast) {
log.Log(CHANGE, "dns lookup speed changed =", newSpeed)
diff --git a/structs.go b/structs.go
index f794773..c3f6622 100644
--- a/structs.go
+++ b/structs.go
@@ -18,13 +18,9 @@ type Host struct {
hostnameStatus *gui.Node // a summary for the user of where things are
- // hostname string // mirrors
domainname *gui.Node // kernel.org
hostshort *gui.Node // hostname -s
- // fqdn string // mirrors.kernel.org
-// dnsTTL int `default:"3"` // Recheck DNS is working every TTL (in seconds)
-// dnsTTLsleep float64 // sleep between loops
artificialSleep float64 `default:"0.7"` // artificial sleep on startup
artificialS string `default:"abc"` // artificial sleep on startup
@@ -71,22 +67,16 @@ type Host struct {
DnsSpeedActual *gui.Node // the last actual duration
DnsSpeedLast string // the last state 'FAST', 'OK', etc
- fix *gui.Node // button for the user to click
- fixProc *gui.Node // button for the user to click
+ // fix *gui.Node // button for the user to click
+ // fixProc *gui.Node // button for the user to click
- mainStatus *gui.Node // group for the main display of stuff
- cloudflareB *gui.Node // cloudflare button
-
- dbOn *gui.Node // button for setting debugging on
- dbNet *gui.Node // button for setting network debugging on
- dbProc *gui.Node // button for setting proc debugging on
+ // mainStatus *gui.Node // group for the main display of stuff
+ // cloudflareB *gui.Node // cloudflare button
digStatus *digStatus
statusIPv6 *gadgets.OneLiner
digStatusButton *gui.Node
- hostnameStatusButton *gui.Node
-
myDebug *gui.Node
myGui *gui.Node
}