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[5].Color = defaultTextBlack
|
||||||
mh.Rows[row].HumanData[6].Text = fmt.Sprintf("Details %s",item.Name)
|
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=", item)
|
||||||
log.Println("\titem.Name=", item.Name)
|
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/jsonpb"
|
||||||
// import "github.com/golang/protobuf/proto"
|
// 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 "git.wit.com/wit/gui"
|
||||||
import pb "git.wit.com/wit/witProtobuf"
|
import pb "git.wit.com/wit/witProtobuf"
|
||||||
|
import "git.wit.com/jcarr/dnssecsocket"
|
||||||
|
|
||||||
import "github.com/gobuffalo/packr"
|
import "github.com/gobuffalo/packr"
|
||||||
import "github.com/davecgh/go-spew/spew"
|
import "github.com/davecgh/go-spew/spew"
|
||||||
|
@ -77,6 +81,15 @@ func onExit(err error) {
|
||||||
|
|
||||||
var packrBox packr.Box
|
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() {
|
func main() {
|
||||||
// This puts all the files in that directory in the binary
|
// This puts all the files in that directory in the binary
|
||||||
// This directory includes the default config file if there is not already one
|
// 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.Width = int(pbC.Width)
|
||||||
gui.Data.Height = int(pbC.Height)
|
gui.Data.Height = int(pbC.Height)
|
||||||
|
|
||||||
// TODO: figure out the hostname the right way
|
|
||||||
hostname := fqdn.Get()
|
hostname := fqdn.Get()
|
||||||
log.Println("fqdn.Get() = ", hostname)
|
log.Println("fqdn.Get() = ", hostname)
|
||||||
gui.Data.Hostname = 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.Version = "v0.7"
|
||||||
gui.Data.GitCommit = GITCOMMIT
|
gui.Data.GitCommit = GITCOMMIT
|
||||||
gui.Data.GoVersion = GOVERSION
|
gui.Data.GoVersion = GOVERSION
|
||||||
gui.Data.Buildtime = BUILDTIME
|
gui.Data.Buildtime = BUILDTIME
|
||||||
gui.Data.MouseClick = mainButtonClick
|
gui.Data.MouseClick = mainMouseClick
|
||||||
gui.Data.HomeDir = user.HomeDir
|
gui.Data.HomeDir = user.HomeDir
|
||||||
|
|
||||||
// Set output debugging level
|
// Set output debugging level
|
||||||
|
@ -142,9 +157,9 @@ func main() {
|
||||||
gui.GoMainWindow()
|
gui.GoMainWindow()
|
||||||
}
|
}
|
||||||
|
|
||||||
func mainButtonClick(b *gui.ButtonMap) {
|
// This is the handler for all mosue clicks (buttons, areas, etc))
|
||||||
log.Println("mainButtonClick() b =", b)
|
func mainMouseClick(b *gui.ButtonMap) {
|
||||||
|
log.Println("mainMouseClick() b =", b)
|
||||||
|
|
||||||
if (b == nil) {
|
if (b == nil) {
|
||||||
log.Println("main() BACK IN CONTROL PANEL CODE (button is nil) WHY DID THIS HAPPEN?")
|
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?")
|
log.Println("main() BACK IN CONTROL PANEL CODE (button is nil) WHY DID THIS HAPPEN?")
|
||||||
} else {
|
} else {
|
||||||
gui.Data.Current = b.Account
|
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, ")")
|
log.Println("main() BACK IN CONTROL PANEL CODE (button =", b, ")")
|
||||||
if (b.Action == "BACK") {
|
if (b.Action == "BACK") {
|
||||||
|
@ -253,8 +268,8 @@ func mainButtonClick(b *gui.ButtonMap) {
|
||||||
log.Println("SHOW VMS currentMessage =", currentMessage)
|
log.Println("SHOW VMS currentMessage =", currentMessage)
|
||||||
log.Println("SHOW VMS count =", count)
|
log.Println("SHOW VMS count =", count)
|
||||||
if (count != 0) {
|
if (count != 0) {
|
||||||
name := "Virtual Machines (" + "FIXME" + ")"
|
name := "Virtual Machines (" + b.Account.Nick + ")"
|
||||||
mh := gui.AddVmsTab(name, count)
|
mh := gui.AddVmsTab(name, count, b.Account)
|
||||||
ReadReceivedData(currentMessage, mh)
|
ReadReceivedData(currentMessage, mh)
|
||||||
}
|
}
|
||||||
currentMessage = nil
|
currentMessage = nil
|
||||||
|
|
Loading…
Reference in New Issue