more status cleanups
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
b3f9ad4262
commit
9b4d2d9a08
74
gui.go
74
gui.go
|
@ -58,44 +58,6 @@ func debugTab(title string) {
|
||||||
me.debug.Hide()
|
me.debug.Hide()
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
// doesn't actually do any network traffic
|
|
||||||
// it just updates the GUI
|
|
||||||
func displayDNS() string {
|
|
||||||
var aaaa []string
|
|
||||||
aaaa = append(aaaa, "blah", "more")
|
|
||||||
// h := me.hostname
|
|
||||||
var all string
|
|
||||||
var broken string = "unknown"
|
|
||||||
for _, s := range aaaa {
|
|
||||||
log.Log(STATUS, "host", "fixme", "DNS AAAA =", s, "ipmap[s] =", me.ipmap[s])
|
|
||||||
all += s + "\n"
|
|
||||||
if ( me.ipmap[s] == nil) {
|
|
||||||
log.Warn("THIS IS THE WRONG AAAA DNS ENTRY: host", "fixme", "DNS AAAA =", s)
|
|
||||||
broken = "wrong AAAA entry"
|
|
||||||
} else {
|
|
||||||
if (broken == "unknown") {
|
|
||||||
broken = "needs update"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var a []string
|
|
||||||
a = append(a, "fixme")
|
|
||||||
sort.Strings(a)
|
|
||||||
all = strings.Join(a, "\n")
|
|
||||||
if (all == "") {
|
|
||||||
log.Log(NOW, "THERE IS NOT a real A DNS ENTRY")
|
|
||||||
all = "CNAME ipv6.wit.com"
|
|
||||||
}
|
|
||||||
if (me.DnsA.S != all) {
|
|
||||||
log.Log(NOW, "DnsA.SetText() to:", all)
|
|
||||||
me.DnsA.SetText(all)
|
|
||||||
}
|
|
||||||
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")
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
|
@ -105,11 +67,6 @@ func mainWindow(title string) {
|
||||||
me.window = gadgets.NewBasicWindow(me.myGui, title)
|
me.window = gadgets.NewBasicWindow(me.myGui, title)
|
||||||
|
|
||||||
gr := me.window.Box().NewGroup("dns update")
|
gr := me.window.Box().NewGroup("dns update")
|
||||||
grid := gr.NewGrid("gridnuts", 2, 2)
|
|
||||||
|
|
||||||
grid.SetNext(1,1)
|
|
||||||
|
|
||||||
me.hostname = gadgets.NewOneLiner(grid, "hostname =").Set("unknown")
|
|
||||||
|
|
||||||
// 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 () {
|
||||||
|
@ -119,16 +76,13 @@ func mainWindow(title string) {
|
||||||
}
|
}
|
||||||
log.Log(CHANGE, "IPv6 WORKED")
|
log.Log(CHANGE, "IPv6 WORKED")
|
||||||
// update everything here visually for the user
|
// update everything here visually for the user
|
||||||
hostname := me.statusOS.GetHostname()
|
// hostname := me.statusOS.GetHostname()
|
||||||
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.Pad()
|
|
||||||
|
|
||||||
statusGrid(me.window.Box())
|
statusGrid(me.window.Box())
|
||||||
|
|
||||||
gr = me.window.Box().NewGroup("debugging")
|
gr = me.window.Box().NewGroup("debugging")
|
||||||
|
@ -203,6 +157,7 @@ func updateDNS() {
|
||||||
|
|
||||||
// log.Println("digAAAA()")
|
// log.Println("digAAAA()")
|
||||||
|
|
||||||
|
/*
|
||||||
if me.statusOS.ValidHostname() {
|
if me.statusOS.ValidHostname() {
|
||||||
var aaaa []string
|
var aaaa []string
|
||||||
h := me.statusOS.GetHostname()
|
h := me.statusOS.GetHostname()
|
||||||
|
@ -221,32 +176,9 @@ func updateDNS() {
|
||||||
cloudflare.CFdialog.NameNode.SetText(h)
|
cloudflare.CFdialog.NameNode.SetText(h)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
d := deleteAAA()
|
|
||||||
if (d != "") {
|
|
||||||
if (cloudflare.CFdialog.ValueNode != nil) {
|
|
||||||
cloudflare.CFdialog.ValueNode.SetText(d)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
// m := missingAAAA()
|
|
||||||
// if (m != "") {
|
|
||||||
// if (cloudflare.CFdialog.ValueNode != nil) {
|
|
||||||
// cloudflare.CFdialog.ValueNode.SetText(m)
|
|
||||||
// }
|
|
||||||
// /*
|
|
||||||
// rr := &cloudflare.RRT{
|
|
||||||
// Type: "AAAA",
|
|
||||||
// Name: me.hostname,
|
|
||||||
// Ttl: "Auto",
|
|
||||||
// Proxied: false,
|
|
||||||
// Content: m,
|
|
||||||
// }
|
|
||||||
// cloudflare.Update(rr)
|
|
||||||
// */
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 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)
|
||||||
|
|
||||||
|
|
8
main.go
8
main.go
|
@ -157,9 +157,17 @@ func dnsTTL() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// run update on the LinuxStatus() window
|
// run update on the LinuxStatus() window
|
||||||
|
// also update a few things on the main window
|
||||||
func linuxLoop() {
|
func linuxLoop() {
|
||||||
me.statusOS.Update()
|
me.statusOS.Update()
|
||||||
|
|
||||||
|
if me.statusOS.ValidHostname() {
|
||||||
|
if me.hostnameStatus.GetText() != "VALID" {
|
||||||
|
me.hostnameStatus.Set("VALID")
|
||||||
|
me.changed = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (me.statusOS.Changed()) {
|
if (me.statusOS.Changed()) {
|
||||||
stamp := time.Now().Format("2006/01/02 15:04:05")
|
stamp := time.Now().Format("2006/01/02 15:04:05")
|
||||||
log.Log(CHANGE, "Network things changed on", stamp)
|
log.Log(CHANGE, "Network things changed on", stamp)
|
||||||
|
|
|
@ -27,7 +27,7 @@ type Host struct {
|
||||||
digStatus *digStatus // window of the results of DNS lookups
|
digStatus *digStatus // window of the results of DNS lookups
|
||||||
|
|
||||||
hostnameStatus *gui.Node // a summary for the user of where things are
|
hostnameStatus *gui.Node // a summary for the user of where things are
|
||||||
hostname *gadgets.OneLiner // the hostname grabbed from gadget.linuxStatus
|
// hostname *gadgets.OneLiner // the hostname grabbed from gadget.linuxStatus
|
||||||
|
|
||||||
artificialSleep float64 `default:"0.7"` // artificial sleep on startup
|
artificialSleep float64 `default:"0.7"` // artificial sleep on startup
|
||||||
artificialS string `default:"abc"` // artificial sleep on startup
|
artificialS string `default:"abc"` // artificial sleep on startup
|
||||||
|
|
Loading…
Reference in New Issue