summaryrefslogtreecommitdiff
path: root/gui.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2023-02-18 23:37:11 -0600
committerJeff Carr <[email protected]>2023-02-18 23:37:11 -0600
commit7ad38cdf6c3fdb7bc7f0c36ed2c1c63426a3b906 (patch)
tree5e4fc79919546fdd0ea34fd67be4001d504f446c /gui.go
parent3959b6c328fc335475f2e9df8aaabbc9a1ca7c43 (diff)
v0.0.2 next step: acutally try to nsupdate
upto the point where DNS update is next. start displaying real AAAA & naming buttons add RFC 2136 defining nsupdate. Vixie et al in 1997 Personal thansk to Paul for meeting with me some years back ready to pull DNS records starting a checkDNS() function dampen output. actually track IPs poll every 2 seconds (netlink is not the right thing here) ready to start looking for changes screw everything about logging. I hate log.whatthefuck*(){} Do you know what I don't care about? log() You shouldn't care either. Ignore it until you need it that is what logging is for. building something that works. So, here you go. a damn log() function in one place Also, because I'm annoyed today sleep() and exit() Because, when I want you to sleep or exit, I don't want to go to the top of a file and declare stupid shit related to nanoseconds or add "import os.Exit" or whatever the hell stop wasting my time. life is short. if he sit tunnelbroker down add IsRealIP() and IsIPv6() need a netlink function to trigger on changes (nope) put the gui plugin's in the debian package for now set the window title build a .deb package Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'gui.go')
-rw-r--r--gui.go59
1 files changed, 39 insertions, 20 deletions
diff --git a/gui.go b/gui.go
index 732a7b3..ce7e7b7 100644
--- a/gui.go
+++ b/gui.go
@@ -4,7 +4,6 @@ package main
import (
"os"
"os/user"
- "log"
"net"
"git.wit.org/wit/gui"
"github.com/davecgh/go-spew/spew"
@@ -13,14 +12,14 @@ import (
// This initializes the first window
func initGUI() {
var w *gui.Node
- gui.Config.Title = "Hello World golang wit/gui Window"
+ gui.Config.Title = "DNS and IPv6 Control Panel"
gui.Config.Width = 640
gui.Config.Height = 480
gui.Config.Exit = myDefaultExit
w = gui.NewWindow()
w.Dump()
- addDemoTab(w, "A Simple Tab Demo")
+ addDNSTab(w, "DNS")
// TODO: add these back
if (args.GuiDemo) {
@@ -32,16 +31,14 @@ func initGUI() {
}
}
-func addDemoTab(window *gui.Node, title string) {
+func addDNSTab(window *gui.Node, title string) {
var newNode, g, g2, tb *gui.Node
- var err error
- var name string
newNode = window.NewTab(title)
- log.Println("addDemoTab() newNode.Dump")
+ log("addDemoTab() newNode.Dump")
newNode.Dump()
- g = newNode.NewGroup("group 1")
+ g = newNode.NewGroup("junk")
dd := g.NewDropdown("demoCombo2")
dd.AddDropdownName("more 1")
dd.AddDropdownName("more 2")
@@ -49,27 +46,49 @@ func addDemoTab(window *gui.Node, title string) {
dd.OnChanged = func(*gui.Node) {
s := dd.GetText()
tb.SetText("hello world " + args.User + "\n" + s)
+ log("text =", s)
}
+ g.NewLabel("UID =")
+ g.NewButton("hello", func () {
+ log("world")
+ })
+
- g2 = newNode.NewGroup("group 2")
+ g2 = newNode.NewGroup("Real Stuff")
tb = g2.NewTextbox("tb")
- log.Println("tb =", tb.GetText())
+ log("tb =", tb.GetText())
tb.OnChanged = func(*gui.Node) {
s := tb.GetText()
- log.Println("text =", s)
+ log("text =", s)
}
- g2.NewButton("hello", func () {
- log.Println("world")
- scanInterfaces()
+ g2.NewButton("Network Interfaces", func () {
+ for i, t := range me.ifmap {
+ log("name =", t.iface.Name)
+ log("int =", i, "name =", t.name, t.iface)
+ dd.AddDropdownName(t.iface.Name)
+ }
})
- g2.NewButton("os.Hostname()", func () {
- name, err = os.Hostname()
- log.Println("name =", name, err)
+ g2.NewButton("Hostname", func () {
+ getHostname()
+ g.NewLabel("FQDN = " + me.fqdn)
+ })
+ g2.NewButton("Actual AAAA", func () {
+ var aaaa []string
+ aaaa = realAAAA()
+ for _, s := range aaaa {
+ g.NewLabel("my actual AAAA = " + s)
+ }
+ })
+ g2.NewButton("checkDNS()", func () {
+ checkDNS()
})
g2.NewButton("os.User()", func () {
user, _ := user.Current()
spew.Dump(user)
- log.Println("os.Getuid =", os.Getuid())
+ log("os.Getuid =", os.Getuid())
+ })
+ g2.NewButton("Example_listLink()", func () {
+ Example_listLink()
})
g2.NewButton("Escalate()", func () {
Escalate()
@@ -79,7 +98,7 @@ func addDemoTab(window *gui.Node, title string) {
if err != nil {
return
}
- log.Println("host =", host)
+ log("host =", host)
})
g2.NewButton("DumpPublicDNSZone(apple.com)", func () {
DumpPublicDNSZone("apple.com")
@@ -88,6 +107,6 @@ func addDemoTab(window *gui.Node, title string) {
}
func myDefaultExit(n *gui.Node) {
- log.Println("You can Do exit() things here")
+ log("You can Do exit() things here")
os.Exit(0)
}