fix extra parsing

This commit is contained in:
Jordan Whited
2020-05-15 16:30:33 -07:00
parent a3627a0f27
commit 4873385214
2 changed files with 5 additions and 3 deletions

View File

@@ -96,13 +96,13 @@ func main() {
pubKeyBase64)
}
var endpointIP net.IP
hostA, ok := r.Answer[0].(*dns.A)
hostA, ok := r.Extra[0].(*dns.A)
if !ok {
hostAAAA, ok := r.Answer[0].(*dns.AAAA)
hostAAAA, ok := r.Extra[0].(*dns.AAAA)
if !ok {
log.Printf(
"[%s] non-A/AAAA extra in SRV response: %s",
pubKeyBase64, r.Extra[0].Header())
pubKeyBase64, r.Extra[0].String())
continue
}
endpointIP = hostAAAA.AAAA