diff options
| -rw-r--r-- | gui.go | 20 | ||||
| -rw-r--r-- | hostname.go | 4 | ||||
| -rw-r--r-- | main.go | 11 | ||||
| -rw-r--r-- | net.go | 10 |
4 files changed, 29 insertions, 16 deletions
@@ -4,6 +4,7 @@ package main import ( "os" "os/user" + "strconv" "net" "git.wit.org/wit/gui" "git.wit.org/wit/shell" @@ -23,7 +24,7 @@ func initGUI() { if (args.GuiDebug) { gui.DebugWindow() } - gui.ShowDebugValues() + // gui.ShowDebugValues() } func addDNSTab(title string) { @@ -39,7 +40,7 @@ func addDNSTab(title string) { for i, t := range me.ifmap { log("name =", t.iface.Name) log("int =", i, "name =", t.name, t.iface) - output("iface = " + t.iface.Name + "\n", true) + log("iface = " + t.iface.Name) } }) g2.NewButton("Hostname", func () { @@ -49,7 +50,7 @@ func addDNSTab(title string) { var aaaa []string aaaa = realAAAA() for _, s := range aaaa { - output("my actual AAAA = " + s + "\n", true) + log("my actual AAAA = ", s) } }) @@ -59,7 +60,11 @@ func addDNSTab(title string) { g2.NewButton("os.User()", func () { user, _ := user.Current() spew.Dump(user) - log("os.Getuid =", os.Getuid()) + log("os.Getuid =", user.Username, os.Getuid()) + if (me.uid != nil) { + me.uid.AddText(user.Username + " (" + strconv.Itoa(os.Getuid()) + ")") + me.uid.SetText(user.Username + " (" + strconv.Itoa(os.Getuid()) + ")") + } }) g2.NewButton("Example_listLink()", func () { Example_listLink() @@ -111,15 +116,15 @@ func nsupdateGroup(w *gui.Node) { grid.SetNext(1,1) grid.NewLabel("hostname =") - grid.SetNext(1,2) + // grid.SetNext(1,2) me.fqdn = grid.NewCombobox("foo(0,1)") 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.SetNext(2,1) grid.NewLabel("UID =") - grid.SetNext(2,2) + // grid.SetNext(2,2) me.uid = grid.NewCombobox("foo(1,1)") me.uid.AddText("root (0)") me.uid.AddText("mail (8)") @@ -133,7 +138,6 @@ func nsupdateGroup(w *gui.Node) { grid.NewLabel("interfaces =") me.Interfaces = grid.NewCombobox("foo(1,3)") - me.Interfaces.AddText("jcarr0") g.NewButton("DNS AAAA", func () { var aaaa []string diff --git a/hostname.go b/hostname.go index 9f5a66f..1906079 100644 --- a/hostname.go +++ b/hostname.go @@ -27,10 +27,10 @@ func getHostname() { } if (me.fqdn != nil) { // s = me.fqdn.GetText() - output("trying to update gui.Label", true) + log("trying to update gui.Label") me.fqdn.SetText(s) } - output("FQDN = jcarr" + s + "\n", true) + log("FQDN =", s) } func dnsAAAA(s string) []string { @@ -40,7 +40,7 @@ func main() { log("Toolkit = ", args.Toolkit) // gui.InitPlugins([]string{"andlabs"}) - gui.SetDebug(true) + // gui.SetDebug(true) gui.Main(initGUI) } @@ -65,18 +65,17 @@ func checkNetworkChanges() { // Run this every once and a while func dnsTTL() { - output("FQDN = " + me.fqdn.GetText() + "\n", false) + log("FQDN =", me.fqdn.GetText()) getHostname() scanInterfaces() for i, t := range me.ifmap { - output(strconv.Itoa(i) + " iface = " + t.iface.Name + "\n", true) + log(strconv.Itoa(i) + " iface = " + t.iface.Name) } var aaaa []string aaaa = realAAAA() for _, s := range aaaa { - output("my actual AAAA = " + s + "\n", true) - me.IPv6.AddText(s) + log("my actual AAAA = ",s) + // me.IPv6.AddText(s) me.IPv6.SetText(s) } - // loggo() } @@ -81,6 +81,7 @@ func checkInterface(i net.Interface) { me.ipchange = true if (me.Interfaces != nil) { me.Interfaces.AddText(i.Name) + me.Interfaces.SetText(i.Name) } return } @@ -92,6 +93,7 @@ func checkInterface(i net.Interface) { me.ipchange = true if (me.Interfaces != nil) { me.Interfaces.AddText(i.Name) + me.Interfaces.SetText(i.Name) } return } @@ -162,9 +164,17 @@ func checkIP(ip *net.IPNet, i net.Interface) bool { me.ipmap[realip].ipv6 = true me.ipmap[realip].ipv4 = false t = "IPv6" + if (me.IPv6 != nil) { + me.IPv6.AddText(realip) + me.IPv6.SetText(realip) + } } else { me.ipmap[realip].ipv6 = false me.ipmap[realip].ipv4 = true + if (me.IPv4 != nil) { + me.IPv4.AddText(realip) + me.IPv4.SetText(realip) + } } if (IsReal(&ip.IP)) { log("\tIP is Real ", t, i.Index, i.Name, realip) |
