don't return SRV answer if endpoint is nil

This commit is contained in:
Jordan Whited 2020-05-15 13:15:42 -07:00
parent 5c7c582a2a
commit dbe0623624

View File

@ -76,6 +76,9 @@ func (p *WGSD) ServeDNS(ctx context.Context, w dns.ResponseWriter,
// TODO: handle SOA // TODO: handle SOA
case name == spPrefix && qtype == dns.TypePTR: case name == spPrefix && qtype == dns.TypePTR:
for _, peer := range device.Peers { for _, peer := range device.Peers {
if peer.Endpoint == nil {
continue
}
m.Answer = append(m.Answer, &dns.PTR{ m.Answer = append(m.Answer, &dns.PTR{
Hdr: dns.RR_Header{ Hdr: dns.RR_Header{
Name: state.Name(), Name: state.Name(),