fix crash on nil
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
6b0763c3fd
commit
df91e3b191
11
main.go
11
main.go
|
@ -85,6 +85,9 @@ func lookupAAAA(hostname string) string {
|
|||
// lookup the IP address from DNS
|
||||
dnsRR := dnssecsocket.Dnstrace(hostname, "AAAA")
|
||||
spew.Dump(dnsRR)
|
||||
if (dnsRR == nil) {
|
||||
return "BROKEN"
|
||||
}
|
||||
ipaddr := dns.Field(dnsRR, 1)
|
||||
log.Println("ipaddr", ipaddr)
|
||||
return ipaddr
|
||||
|
@ -122,11 +125,14 @@ func main() {
|
|||
gui.Data.Width = int(pbC.Width)
|
||||
gui.Data.Height = int(pbC.Height)
|
||||
|
||||
// use this to discover what the OS thinks it's hostname is
|
||||
// seems to be cross platform (?)
|
||||
hostname := fqdn.Get()
|
||||
log.Println("fqdn.Get() = ", hostname)
|
||||
gui.Data.Hostname = hostname
|
||||
// TODO: figure out the IPv6 address the right way
|
||||
// probably dig <hostname> AAAA
|
||||
|
||||
// this is a recursive dig for the AAAA record
|
||||
// TODO: check for dns hijacking
|
||||
ipAAAA := lookupAAAA(hostname)
|
||||
gui.Data.IPv6 = ipAAAA
|
||||
|
||||
|
@ -368,7 +374,6 @@ func watchGUI() {
|
|||
}
|
||||
if (gui.Data.State == "CREATE") {
|
||||
log.Println("\tTRIGGERING CREATE HERE")
|
||||
|
||||
event := pb.MakeAddVmEvent()
|
||||
event.Username = gui.Data.Current.Username
|
||||
event.Token = gui.Data.Current.Token
|
||||
|
|
Loading…
Reference in New Issue