fields are displaying. ready to add DNS
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
8e2f94c4ac
commit
058f142127
20
gui.go
20
gui.go
|
@ -4,6 +4,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
"os/user"
|
"os/user"
|
||||||
|
"strconv"
|
||||||
"net"
|
"net"
|
||||||
"git.wit.org/wit/gui"
|
"git.wit.org/wit/gui"
|
||||||
"git.wit.org/wit/shell"
|
"git.wit.org/wit/shell"
|
||||||
|
@ -23,7 +24,7 @@ func initGUI() {
|
||||||
if (args.GuiDebug) {
|
if (args.GuiDebug) {
|
||||||
gui.DebugWindow()
|
gui.DebugWindow()
|
||||||
}
|
}
|
||||||
gui.ShowDebugValues()
|
// gui.ShowDebugValues()
|
||||||
}
|
}
|
||||||
|
|
||||||
func addDNSTab(title string) {
|
func addDNSTab(title string) {
|
||||||
|
@ -39,7 +40,7 @@ func addDNSTab(title string) {
|
||||||
for i, t := range me.ifmap {
|
for i, t := range me.ifmap {
|
||||||
log("name =", t.iface.Name)
|
log("name =", t.iface.Name)
|
||||||
log("int =", i, "name =", t.name, t.iface)
|
log("int =", i, "name =", t.name, t.iface)
|
||||||
output("iface = " + t.iface.Name + "\n", true)
|
log("iface = " + t.iface.Name)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
g2.NewButton("Hostname", func () {
|
g2.NewButton("Hostname", func () {
|
||||||
|
@ -49,7 +50,7 @@ func addDNSTab(title string) {
|
||||||
var aaaa []string
|
var aaaa []string
|
||||||
aaaa = realAAAA()
|
aaaa = realAAAA()
|
||||||
for _, s := range aaaa {
|
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 () {
|
g2.NewButton("os.User()", func () {
|
||||||
user, _ := user.Current()
|
user, _ := user.Current()
|
||||||
spew.Dump(user)
|
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 () {
|
g2.NewButton("Example_listLink()", func () {
|
||||||
Example_listLink()
|
Example_listLink()
|
||||||
|
@ -111,15 +116,15 @@ func nsupdateGroup(w *gui.Node) {
|
||||||
|
|
||||||
grid.SetNext(1,1)
|
grid.SetNext(1,1)
|
||||||
grid.NewLabel("hostname =")
|
grid.NewLabel("hostname =")
|
||||||
grid.SetNext(1,2)
|
// grid.SetNext(1,2)
|
||||||
me.fqdn = grid.NewCombobox("foo(0,1)")
|
me.fqdn = grid.NewCombobox("foo(0,1)")
|
||||||
me.fqdn.AddText("fire.lab.wit.com")
|
me.fqdn.AddText("fire.lab.wit.com")
|
||||||
me.fqdn.AddText("mirrors.wit.com")
|
me.fqdn.AddText("mirrors.wit.com")
|
||||||
me.fqdn.SetText("sad.lab.wit.org")
|
me.fqdn.SetText("sad.lab.wit.org")
|
||||||
|
|
||||||
grid.SetNext(2,1)
|
// grid.SetNext(2,1)
|
||||||
grid.NewLabel("UID =")
|
grid.NewLabel("UID =")
|
||||||
grid.SetNext(2,2)
|
// grid.SetNext(2,2)
|
||||||
me.uid = grid.NewCombobox("foo(1,1)")
|
me.uid = grid.NewCombobox("foo(1,1)")
|
||||||
me.uid.AddText("root (0)")
|
me.uid.AddText("root (0)")
|
||||||
me.uid.AddText("mail (8)")
|
me.uid.AddText("mail (8)")
|
||||||
|
@ -133,7 +138,6 @@ 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)")
|
||||||
me.Interfaces.AddText("jcarr0")
|
|
||||||
|
|
||||||
g.NewButton("DNS AAAA", func () {
|
g.NewButton("DNS AAAA", func () {
|
||||||
var aaaa []string
|
var aaaa []string
|
||||||
|
|
|
@ -27,10 +27,10 @@ func getHostname() {
|
||||||
}
|
}
|
||||||
if (me.fqdn != nil) {
|
if (me.fqdn != nil) {
|
||||||
// s = me.fqdn.GetText()
|
// s = me.fqdn.GetText()
|
||||||
output("trying to update gui.Label", true)
|
log("trying to update gui.Label")
|
||||||
me.fqdn.SetText(s)
|
me.fqdn.SetText(s)
|
||||||
}
|
}
|
||||||
output("FQDN = jcarr" + s + "\n", true)
|
log("FQDN =", s)
|
||||||
}
|
}
|
||||||
|
|
||||||
func dnsAAAA(s string) []string {
|
func dnsAAAA(s string) []string {
|
||||||
|
|
11
main.go
11
main.go
|
@ -40,7 +40,7 @@ func main() {
|
||||||
|
|
||||||
log("Toolkit = ", args.Toolkit)
|
log("Toolkit = ", args.Toolkit)
|
||||||
// gui.InitPlugins([]string{"andlabs"})
|
// gui.InitPlugins([]string{"andlabs"})
|
||||||
gui.SetDebug(true)
|
// gui.SetDebug(true)
|
||||||
gui.Main(initGUI)
|
gui.Main(initGUI)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,18 +65,17 @@ func checkNetworkChanges() {
|
||||||
|
|
||||||
// Run this every once and a while
|
// Run this every once and a while
|
||||||
func dnsTTL() {
|
func dnsTTL() {
|
||||||
output("FQDN = " + me.fqdn.GetText() + "\n", false)
|
log("FQDN =", me.fqdn.GetText())
|
||||||
getHostname()
|
getHostname()
|
||||||
scanInterfaces()
|
scanInterfaces()
|
||||||
for i, t := range me.ifmap {
|
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
|
var aaaa []string
|
||||||
aaaa = realAAAA()
|
aaaa = realAAAA()
|
||||||
for _, s := range aaaa {
|
for _, s := range aaaa {
|
||||||
output("my actual AAAA = " + s + "\n", true)
|
log("my actual AAAA = ",s)
|
||||||
me.IPv6.AddText(s)
|
// me.IPv6.AddText(s)
|
||||||
me.IPv6.SetText(s)
|
me.IPv6.SetText(s)
|
||||||
}
|
}
|
||||||
// loggo()
|
|
||||||
}
|
}
|
||||||
|
|
10
net.go
10
net.go
|
@ -81,6 +81,7 @@ func checkInterface(i net.Interface) {
|
||||||
me.ipchange = true
|
me.ipchange = true
|
||||||
if (me.Interfaces != nil) {
|
if (me.Interfaces != nil) {
|
||||||
me.Interfaces.AddText(i.Name)
|
me.Interfaces.AddText(i.Name)
|
||||||
|
me.Interfaces.SetText(i.Name)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -92,6 +93,7 @@ func checkInterface(i net.Interface) {
|
||||||
me.ipchange = true
|
me.ipchange = true
|
||||||
if (me.Interfaces != nil) {
|
if (me.Interfaces != nil) {
|
||||||
me.Interfaces.AddText(i.Name)
|
me.Interfaces.AddText(i.Name)
|
||||||
|
me.Interfaces.SetText(i.Name)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -162,9 +164,17 @@ func checkIP(ip *net.IPNet, i net.Interface) bool {
|
||||||
me.ipmap[realip].ipv6 = true
|
me.ipmap[realip].ipv6 = true
|
||||||
me.ipmap[realip].ipv4 = false
|
me.ipmap[realip].ipv4 = false
|
||||||
t = "IPv6"
|
t = "IPv6"
|
||||||
|
if (me.IPv6 != nil) {
|
||||||
|
me.IPv6.AddText(realip)
|
||||||
|
me.IPv6.SetText(realip)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
me.ipmap[realip].ipv6 = false
|
me.ipmap[realip].ipv6 = false
|
||||||
me.ipmap[realip].ipv4 = true
|
me.ipmap[realip].ipv4 = true
|
||||||
|
if (me.IPv4 != nil) {
|
||||||
|
me.IPv4.AddText(realip)
|
||||||
|
me.IPv4.SetText(realip)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (IsReal(&ip.IP)) {
|
if (IsReal(&ip.IP)) {
|
||||||
log("\tIP is Real ", t, i.Index, i.Name, realip)
|
log("\tIP is Real ", t, i.Index, i.Name, realip)
|
||||||
|
|
Loading…
Reference in New Issue