fields are displaying. ready to add DNS

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2023-03-25 08:40:48 -05:00
parent 8e2f94c4ac
commit 058f142127
4 changed files with 29 additions and 16 deletions

20
gui.go
View File

@ -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

View File

@ -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 {

11
main.go
View File

@ -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()
}

10
net.go
View File

@ -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)