summaryrefslogtreecommitdiff
path: root/gui.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2023-03-26 16:17:32 -0500
committerJeff Carr <[email protected]>2023-03-26 16:17:32 -0500
commit70a7ca6d75b0bffbd184b1780bca5a9b0db46c70 (patch)
tree3241a5fb24af3624da8abb7380a450116a2ea1ee /gui.go
parent53c8c54b15d396f4efe4335948404814ac04a4dd (diff)
everything auto-updates on open
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'gui.go')
-rw-r--r--gui.go104
1 files changed, 54 insertions, 50 deletions
diff --git a/gui.go b/gui.go
index a9773de..649a437 100644
--- a/gui.go
+++ b/gui.go
@@ -33,6 +33,9 @@ func addDNSTab(title string) {
g2 = me.tab.NewGroup("Real Stuff")
+ g2.NewButton("gui.DebugWindow()", func () {
+ gui.DebugWindow()
+ })
g2.NewButton("Network Interfaces", func () {
for i, t := range me.ifmap {
log("name =", t.iface.Name)
@@ -73,9 +76,6 @@ func addDNSTab(title string) {
g2.NewButton("Escalate()", func () {
Escalate()
})
- g2.NewButton("gui.DebugWindow()", func () {
- gui.DebugWindow()
- })
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 {
@@ -122,60 +122,20 @@ func nsupdateGroup(w *gui.Node) {
grid.NewLabel("DNS A =")
me.DnsA = grid.NewLabel("?")
- grid.NewLabel("DNS Status =")
- me.DnsStatus = grid.NewLabel("unknown")
-
grid.NewLabel("IPv4 =")
- me.IPv4 = grid.NewCombobox("foo(2,1)")
+ me.IPv4 = grid.NewLabel("?")
grid.NewLabel("IPv6 =")
- me.IPv6 = grid.NewCombobox("foo(1,3)")
+ me.IPv6 = grid.NewLabel("?")
grid.NewLabel("interfaces =")
- me.Interfaces = grid.NewCombobox("foo(1,3)")
+ me.Interfaces = grid.NewCombobox("Interfaces")
- g.NewButton("Update DNS", func () {
- var aaaa []string
- h := me.hostname
- if (h == "") {
- h = "unknown.lab.wit.org"
- // h = "hpdevone.lab.wit.org"
- }
- aaaa = dnsAAAA(h)
- log(SPEW, me)
- if (aaaa == nil) {
- log("There are no DNS AAAA records for hostname: ", h)
- }
- var broken int = 0
- var all string
- for _, s := range aaaa {
- 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
- }
- }
- }
- all = strings.TrimSuffix(all, "\r\n")
- all = strings.TrimSuffix(all, "\n")
- me.DnsAAAA.SetText(all)
- if (broken == 1) {
- me.DnsStatus.SetText("WORKING")
- } else {
- me.DnsStatus.SetText("BROKEN")
- log("Need to run go-nsupdate here")
- }
+ grid.NewLabel("DNS Status =")
+ me.DnsStatus = grid.NewLabel("unknown")
- user, _ := user.Current()
- spew.Dump(user)
- log("os.Getuid =", user.Username, os.Getuid())
- if (me.uid != nil) {
- me.uid.SetText(user.Username + " (" + strconv.Itoa(os.Getuid()) + ")")
- }
+ g.NewButton("Update DNS", func () {
+ updateDNS()
me.tab.Margin()
me.tab.Pad()
grid.Pad()
@@ -192,3 +152,47 @@ func output(s string, a bool) {
me.output.SetText(outJunk)
log(outJunk)
}
+
+func updateDNS() {
+ var aaaa []string
+ h := me.hostname
+ if (h == "") {
+ h = "unknown.lab.wit.org"
+ // h = "hpdevone.lab.wit.org"
+ }
+ aaaa = dnsAAAA(h)
+ log(SPEW, me)
+ if (aaaa == nil) {
+ log("There are no DNS AAAA records for hostname: ", h)
+ }
+ var broken int = 0
+ var all string
+ for _, s := range aaaa {
+ 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
+ }
+ }
+ }
+ all = strings.TrimSuffix(all, "\r\n")
+ all = strings.TrimSuffix(all, "\n")
+ me.DnsAAAA.SetText(all)
+ if (broken == 1) {
+ me.DnsStatus.SetText("WORKING")
+ } else {
+ me.DnsStatus.SetText("BROKEN")
+ log("Need to run go-nsupdate here")
+ }
+
+ user, _ := user.Current()
+ spew.Dump(user)
+ log("os.Getuid =", user.Username, os.Getuid())
+ if (me.uid != nil) {
+ me.uid.SetText(user.Username + " (" + strconv.Itoa(os.Getuid()) + ")")
+ }
+}