lookup AAAA record. single CreateButtion() function now
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
4e946e456f
commit
6b0763c3fd
|
@ -122,7 +122,7 @@ func ReadReceivedData(data *pb.Event, mh *gui.TableData) {
|
|||
mh.Rows[row].HumanData[5].Color = defaultTextBlack
|
||||
mh.Rows[row].HumanData[6].Text = fmt.Sprintf("Details %s",item.Name)
|
||||
|
||||
mh.Rows[row].PbVM = item
|
||||
mh.Rows[row].VM = item
|
||||
|
||||
log.Println("\titem=", item)
|
||||
log.Println("\titem.Name=", item.Name)
|
||||
|
|
33
main.go
33
main.go
|
@ -10,8 +10,12 @@ import "runtime/debug"
|
|||
import "github.com/golang/protobuf/jsonpb"
|
||||
// import "github.com/golang/protobuf/proto"
|
||||
|
||||
// this is the king of dns libraries
|
||||
import "github.com/miekg/dns"
|
||||
|
||||
import "git.wit.com/wit/gui"
|
||||
import pb "git.wit.com/wit/witProtobuf"
|
||||
import "git.wit.com/jcarr/dnssecsocket"
|
||||
|
||||
import "github.com/gobuffalo/packr"
|
||||
import "github.com/davecgh/go-spew/spew"
|
||||
|
@ -77,6 +81,15 @@ func onExit(err error) {
|
|||
|
||||
var packrBox packr.Box
|
||||
|
||||
func lookupAAAA(hostname string) string {
|
||||
// lookup the IP address from DNS
|
||||
dnsRR := dnssecsocket.Dnstrace(hostname, "AAAA")
|
||||
spew.Dump(dnsRR)
|
||||
ipaddr := dns.Field(dnsRR, 1)
|
||||
log.Println("ipaddr", ipaddr)
|
||||
return ipaddr
|
||||
}
|
||||
|
||||
func main() {
|
||||
// This puts all the files in that directory in the binary
|
||||
// This directory includes the default config file if there is not already one
|
||||
|
@ -109,17 +122,19 @@ func main() {
|
|||
gui.Data.Width = int(pbC.Width)
|
||||
gui.Data.Height = int(pbC.Height)
|
||||
|
||||
// TODO: figure out the hostname the right way
|
||||
hostname := fqdn.Get()
|
||||
log.Println("fqdn.Get() = ", hostname)
|
||||
gui.Data.Hostname = hostname
|
||||
gui.Data.IPv6 = "2604:bbc0:3:3:0:10:0:1004"
|
||||
// TODO: figure out the IPv6 address the right way
|
||||
// probably dig <hostname> AAAA
|
||||
ipAAAA := lookupAAAA(hostname)
|
||||
gui.Data.IPv6 = ipAAAA
|
||||
|
||||
gui.Data.Version = "v0.7"
|
||||
gui.Data.GitCommit = GITCOMMIT
|
||||
gui.Data.GoVersion = GOVERSION
|
||||
gui.Data.Buildtime = BUILDTIME
|
||||
gui.Data.MouseClick = mainButtonClick
|
||||
gui.Data.MouseClick = mainMouseClick
|
||||
gui.Data.HomeDir = user.HomeDir
|
||||
|
||||
// Set output debugging level
|
||||
|
@ -142,9 +157,9 @@ func main() {
|
|||
gui.GoMainWindow()
|
||||
}
|
||||
|
||||
func mainButtonClick(b *gui.ButtonMap) {
|
||||
log.Println("mainButtonClick() b =", b)
|
||||
|
||||
// This is the handler for all mosue clicks (buttons, areas, etc))
|
||||
func mainMouseClick(b *gui.ButtonMap) {
|
||||
log.Println("mainMouseClick() b =", b)
|
||||
|
||||
if (b == nil) {
|
||||
log.Println("main() BACK IN CONTROL PANEL CODE (button is nil) WHY DID THIS HAPPEN?")
|
||||
|
@ -152,7 +167,7 @@ func mainButtonClick(b *gui.ButtonMap) {
|
|||
log.Println("main() BACK IN CONTROL PANEL CODE (button is nil) WHY DID THIS HAPPEN?")
|
||||
} else {
|
||||
gui.Data.Current = b.Account
|
||||
log.Println("mainButtonClick() setting current account = ", b.Account)
|
||||
log.Println("mainMouseClick() setting current account = ", b.Account)
|
||||
|
||||
log.Println("main() BACK IN CONTROL PANEL CODE (button =", b, ")")
|
||||
if (b.Action == "BACK") {
|
||||
|
@ -253,8 +268,8 @@ func mainButtonClick(b *gui.ButtonMap) {
|
|||
log.Println("SHOW VMS currentMessage =", currentMessage)
|
||||
log.Println("SHOW VMS count =", count)
|
||||
if (count != 0) {
|
||||
name := "Virtual Machines (" + "FIXME" + ")"
|
||||
mh := gui.AddVmsTab(name, count)
|
||||
name := "Virtual Machines (" + b.Account.Nick + ")"
|
||||
mh := gui.AddVmsTab(name, count, b.Account)
|
||||
ReadReceivedData(currentMessage, mh)
|
||||
}
|
||||
currentMessage = nil
|
||||
|
|
Loading…
Reference in New Issue