working pretty well

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2023-03-25 16:19:44 -05:00
parent 90f9015ab2
commit a8285c19c8
2 changed files with 30 additions and 29 deletions

57
gui.go
View File

@ -5,6 +5,7 @@ import (
"os" "os"
"os/user" "os/user"
"strconv" "strconv"
"strings"
"net" "net"
"git.wit.org/wit/gui" "git.wit.org/wit/gui"
"git.wit.org/wit/shell" "git.wit.org/wit/shell"
@ -62,10 +63,14 @@ func addDNSTab(title string) {
spew.Dump(user) spew.Dump(user)
log("os.Getuid =", user.Username, os.Getuid()) log("os.Getuid =", user.Username, os.Getuid())
if (me.uid != nil) { if (me.uid != nil) {
me.uid.AddText(user.Username + " (" + strconv.Itoa(os.Getuid()) + ")")
me.uid.SetText(user.Username + " (" + strconv.Itoa(os.Getuid()) + ")") me.uid.SetText(user.Username + " (" + strconv.Itoa(os.Getuid()) + ")")
} }
}) })
g2.NewButton("dig +trace", func () {
o := shell.Run("dig +trace +noadditional DS " + me.hostname + " @8.8.8.8")
log(o)
// log(o)
})
g2.NewButton("Example_listLink()", func () { g2.NewButton("Example_listLink()", func () {
Example_listLink() Example_listLink()
}) })
@ -109,19 +114,20 @@ func nsupdateGroup(w *gui.Node) {
grid.SetNext(1,1) grid.SetNext(1,1)
grid.NewLabel("hostname =") grid.NewLabel("hostname =")
// grid.SetNext(1,2) me.fqdn = grid.NewLabel("?")
me.fqdn = grid.NewCombobox("foo(0,1)") me.hostname = ""
me.fqdn.AddText("fire.lab.wit.com")
me.fqdn.AddText("mirrors.wit.com")
me.fqdn.SetText("sad.lab.wit.org")
// grid.SetNext(2,1)
grid.NewLabel("UID =") grid.NewLabel("UID =")
// grid.SetNext(2,2) me.uid = grid.NewLabel("?")
me.uid = grid.NewCombobox("foo(1,1)")
me.uid.AddText("root (0)") grid.NewLabel("DNS AAAA =")
me.uid.AddText("mail (8)") me.DnsAAAA = grid.NewLabel("?")
me.uid.AddText("jcarr (1000)")
grid.NewLabel("DNS A =")
me.DnsA = grid.NewLabel("?")
grid.NewLabel("DNS Status =")
me.DnsStatus = grid.NewLabel("unknown")
grid.NewLabel("IPv4 =") grid.NewLabel("IPv4 =")
me.IPv4 = grid.NewCombobox("foo(2,1)") me.IPv4 = grid.NewCombobox("foo(2,1)")
@ -132,16 +138,7 @@ func nsupdateGroup(w *gui.Node) {
grid.NewLabel("interfaces =") grid.NewLabel("interfaces =")
me.Interfaces = grid.NewCombobox("foo(1,3)") me.Interfaces = grid.NewCombobox("foo(1,3)")
grid.NewLabel("DNS AAAA =") g.NewButton("Update DNS", func () {
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 aaaa []string
h := me.hostname h := me.hostname
if (h == "") { if (h == "") {
@ -167,17 +164,21 @@ func nsupdateGroup(w *gui.Node) {
} }
} }
} }
strings.TrimSuffix(all, "\r\n")
me.DnsAAAA.SetText(all) me.DnsAAAA.SetText(all)
if (broken == 1) { if (broken == 1) {
me.DnsStatus.SetText("WORKING") me.DnsStatus.SetText("WORKING")
} else { } else {
me.DnsStatus.SetText("Broken") 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()) + ")")
} }
})
g.NewButton("dig +trace", func () {
o := shell.Run("dig +trace +noadditional DS " + me.fqdn.GetText() + " @8.8.8.8")
output(o, false)
// log(o)
}) })
} }

View File

@ -28,7 +28,7 @@ func getHostname() {
if (me.fqdn != nil) { if (me.fqdn != nil) {
// s = me.fqdn.GetText() // s = me.fqdn.GetText()
log("trying to update gui.Label") log("trying to update gui.Label")
me.fqdn.AddText(s) // me.fqdn.AddText(s)
me.fqdn.SetText(s) me.fqdn.SetText(s)
me.hostname = s me.hostname = s
} }