first gadgets.BasicWindow()
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
d52dc52734
commit
3baa63dadf
84
gui.go
84
gui.go
|
@ -6,7 +6,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"os/user"
|
"os/user"
|
||||||
"strconv"
|
"strconv"
|
||||||
"net"
|
// "net"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
|
@ -15,6 +15,7 @@ import (
|
||||||
"go.wit.com/gui/gui"
|
"go.wit.com/gui/gui"
|
||||||
"go.wit.com/gui/gadgets"
|
"go.wit.com/gui/gadgets"
|
||||||
"go.wit.com/gui/cloudflare"
|
"go.wit.com/gui/cloudflare"
|
||||||
|
"go.wit.com/gui/debugger"
|
||||||
)
|
)
|
||||||
|
|
||||||
// This setups up the dns control panel window
|
// This setups up the dns control panel window
|
||||||
|
@ -36,7 +37,7 @@ func setupControlPanelWindow() {
|
||||||
func detailsTab(title string) {
|
func detailsTab(title string) {
|
||||||
var g2 *gui.Node
|
var g2 *gui.Node
|
||||||
|
|
||||||
tab := me.window.NewTab(title)
|
tab := me.window.NewWindow(title)
|
||||||
|
|
||||||
g2 = tab.NewGroup("Real Stuff")
|
g2 = tab.NewGroup("Real Stuff")
|
||||||
|
|
||||||
|
@ -81,88 +82,42 @@ func detailsTab(title string) {
|
||||||
func debugTab(title string) {
|
func debugTab(title string) {
|
||||||
var g2 *gui.Node
|
var g2 *gui.Node
|
||||||
|
|
||||||
tab := me.window.NewTab(title)
|
tab := me.window.NewWindow(title)
|
||||||
|
|
||||||
g2 = tab.NewGroup("Real Stuff")
|
g2 = tab.NewGroup("Real Stuff")
|
||||||
|
|
||||||
g2.NewButton("Network Interfaces", func () {
|
var hidden bool = true
|
||||||
for i, t := range me.ifmap {
|
g2.NewButton("GO GUI Debug Window", func () {
|
||||||
log.Println("name =", t.iface.Name)
|
if (me.myDebug == nil) {
|
||||||
log.Println("int =", i, "name =", t.name, t.iface)
|
me.myDebug = debugger.DebugWindow(me.window)
|
||||||
log.Println("iface = " + t.iface.Name)
|
hidden = false
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if hidden {
|
||||||
|
me.myDebug.Show()
|
||||||
|
hidden = false
|
||||||
|
} else {
|
||||||
|
me.myDebug.Hide()
|
||||||
|
hidden = true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
g2.NewButton("Hostname", func () {
|
g2.NewButton("getHostname() looks at the OS settings", func () {
|
||||||
getHostname()
|
getHostname()
|
||||||
})
|
})
|
||||||
|
|
||||||
g2.NewButton("Actual AAAA & A", func () {
|
|
||||||
displayDNS() // doesn't re-query anything
|
|
||||||
})
|
|
||||||
|
|
||||||
g2.NewButton("dig A & AAAA DNS records", func () {
|
g2.NewButton("dig A & AAAA DNS records", func () {
|
||||||
log.Println("updateDNS()")
|
log.Println("updateDNS()")
|
||||||
updateDNS()
|
updateDNS()
|
||||||
})
|
})
|
||||||
|
|
||||||
g2.NewButton("checkDNS:", func () {
|
|
||||||
ipv6s, ipv4s := checkDNS()
|
|
||||||
for s, _ := range ipv6s {
|
|
||||||
log.Log(NOW, "check if", s, "is in DNS")
|
|
||||||
}
|
|
||||||
for s, _ := range ipv4s {
|
|
||||||
log.Log(NOW, "check if", s, "is in DNS")
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
g2.NewButton("os.User()", func () {
|
|
||||||
user, _ := user.Current()
|
|
||||||
log.Println("os.Getuid =", user.Username, os.Getuid())
|
|
||||||
if (me.uid != nil) {
|
|
||||||
me.uid.SetText(user.Username + " (" + strconv.Itoa(os.Getuid()) + ")")
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
g2.NewButton("dig +trace", func () {
|
g2.NewButton("dig +trace", func () {
|
||||||
o := shell.Run("dig +trace +noadditional DS " + me.hostname + " @8.8.8.8")
|
o := shell.Run("dig +trace +noadditional DS " + me.hostname + " @8.8.8.8")
|
||||||
log.Println(o)
|
log.Println(o)
|
||||||
})
|
})
|
||||||
|
|
||||||
g2.NewButton("Example_listLink()", func () {
|
|
||||||
Example_listLink()
|
|
||||||
})
|
|
||||||
|
|
||||||
g2.NewButton("Escalate()", func () {
|
|
||||||
Escalate()
|
|
||||||
})
|
|
||||||
|
|
||||||
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 {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
log.Println("host =", host)
|
|
||||||
})
|
|
||||||
|
|
||||||
g2.NewButton("DumpPublicDNSZone(apple.com)", func () {
|
|
||||||
DumpPublicDNSZone("apple.com")
|
|
||||||
dumpIPs("www.apple.com")
|
|
||||||
})
|
|
||||||
|
|
||||||
g2 = tab.NewGroup("debugging options")
|
g2 = tab.NewGroup("debugging options")
|
||||||
|
|
||||||
// DEBUG flags
|
|
||||||
me.dbNet = g2.NewCheckbox("turn on network debugging)")
|
|
||||||
me.dbNet.Custom = func() {
|
|
||||||
log.Warn("TODO: re-implement")
|
|
||||||
}
|
|
||||||
|
|
||||||
me.dbProc = g2.NewCheckbox("turn on /proc debugging)")
|
|
||||||
me.dbProc.Custom = func() {
|
|
||||||
log.Warn("TODO: re-implement")
|
|
||||||
}
|
|
||||||
|
|
||||||
// makes a slider widget
|
// makes a slider widget
|
||||||
me.ttl = gadgets.NewDurationSlider(g2, "Loop Timeout", 10 * time.Millisecond, 5 * time.Second)
|
me.ttl = gadgets.NewDurationSlider(g2, "Loop Timeout", 10 * time.Millisecond, 5 * time.Second)
|
||||||
me.ttl.Set(300 * time.Millisecond)
|
me.ttl.Set(300 * time.Millisecond)
|
||||||
|
@ -245,7 +200,8 @@ func myDefaultExit(n *gui.Node) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func dnsTab(title string) {
|
func dnsTab(title string) {
|
||||||
tab := me.window.NewTab(title)
|
win := me.window.NewWindow(title)
|
||||||
|
tab := win.NewBox("hBox", true)
|
||||||
|
|
||||||
me.mainStatus = tab.NewGroup("dns update")
|
me.mainStatus = tab.NewGroup("dns update")
|
||||||
|
|
||||||
|
|
|
@ -80,6 +80,8 @@ type Host struct {
|
||||||
|
|
||||||
hostnameStatus *hostnameStatus
|
hostnameStatus *hostnameStatus
|
||||||
hostnameStatusButton *gui.Node
|
hostnameStatusButton *gui.Node
|
||||||
|
|
||||||
|
myDebug *gui.Node
|
||||||
}
|
}
|
||||||
|
|
||||||
type IPtype struct {
|
type IPtype struct {
|
||||||
|
|
Loading…
Reference in New Issue