summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gui.go45
-rw-r--r--hostname.go2
-rw-r--r--main.go5
-rw-r--r--structs.go3
4 files changed, 41 insertions, 14 deletions
diff --git a/gui.go b/gui.go
index 3d48523..76aff59 100644
--- a/gui.go
+++ b/gui.go
@@ -72,16 +72,9 @@ func addDNSTab(title string) {
g2.NewButton("Escalate()", func () {
Escalate()
})
- g2.NewButton("pprof(goroutine)", func () {
- // loggo()
- // panic("correctly inside of gui goroutine (goroutine 1?)")
- })
g2.NewButton("gui.DebugWindow()", func () {
gui.DebugWindow()
})
- g2.NewButton("NewCheckbox(test)", func () {
- me.notes.NewCheckbox("test")
- })
g2.NewButton("LookupAddr(<raw ipv6>) == fire from /etc/hosts", func () {
host, err := net.LookupAddr("2600:1700:afd5:6000:b26e:bfff:fe80:3c52")
if err != nil {
@@ -139,18 +132,46 @@ func nsupdateGroup(w *gui.Node) {
grid.NewLabel("interfaces =")
me.Interfaces = grid.NewCombobox("foo(1,3)")
+ grid.NewLabel("DNS AAAA =")
+ me.DnsAAAA = grid.NewLabel("need to lookup")
+
+ grid.NewLabel("DNS A =")
+ me.DnsA = grid.NewLabel("need to lookup")
+
+ grid.NewLabel("DNS Status =")
+ me.DnsStatus = grid.NewLabel("unknown")
+
g.NewButton("DNS AAAA", func () {
var aaaa []string
- var out string
- h := me.fqdn.GetText()
- // h := "fire.lab.wit.org"
+ h := me.hostname
+ if (h == "") {
+ h = "unknown.lab.wit.org"
+ // h = "hpdevone.lab.wit.org"
+ }
aaaa = dnsAAAA(h)
log(SPEW, me)
if (aaaa == nil) {
- out += "There are no DNS AAAA records for hostname: " + h + "\n"
+ log("There are no DNS AAAA records for hostname: ", h)
}
+ var broken int = 0
+ var all string
for _, s := range aaaa {
- out += "host " + h + " DNS AAAA = " + s + "\n"
+ log("host", h, "DNS AAAA =", s)
+ all += s + "\n"
+ if ( me.ipmap[s] == nil) {
+ log("THIS IS THE WRONG AAAA DNS ENTRY: host", h, "DNS AAAA =", s)
+ broken = 2
+ } else {
+ if (broken == 0) {
+ broken = 1
+ }
+ }
+ }
+ me.DnsAAAA.SetText(all)
+ if (broken == 1) {
+ me.DnsStatus.SetText("WORKING")
+ } else {
+ me.DnsStatus.SetText("Broken")
}
})
g.NewButton("dig +trace", func () {
diff --git a/hostname.go b/hostname.go
index 1906079..afd8d0b 100644
--- a/hostname.go
+++ b/hostname.go
@@ -28,7 +28,9 @@ func getHostname() {
if (me.fqdn != nil) {
// s = me.fqdn.GetText()
log("trying to update gui.Label")
+ me.fqdn.AddText(s)
me.fqdn.SetText(s)
+ me.hostname = s
}
log("FQDN =", s)
}
diff --git a/main.go b/main.go
index e03defd..92fb100 100644
--- a/main.go
+++ b/main.go
@@ -48,9 +48,10 @@ func main() {
Poll for changes to the networking settings
*/
func checkNetworkChanges() {
- var ttl int = 3
+ var ttl int = 0
+ var ttlsleep int = 5
for {
- sleep(1)
+ sleep(ttlsleep)
ttl -= 1
if (ttl < 0) {
if (runtime.GOOS == "linux") {
diff --git a/structs.go b/structs.go
index ebc73a6..5134f03 100644
--- a/structs.go
+++ b/structs.go
@@ -28,6 +28,9 @@ type Host struct {
IPv4 *gui.Node // show valid IPv4 addresses
IPv6 *gui.Node // show valid IPv6 addresses
Interfaces *gui.Node // Interfaces
+ DnsAAAA *gui.Node // 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
}
type IPtype struct {