Browse Source

Fix: DNS return value (#1242)

Loyalsoldier 4 years ago
parent
commit
46fa8f7480
2 changed files with 8 additions and 0 deletions
  1. 4 0
      app/dns/nameserver_doh.go
  2. 4 0
      app/dns/nameserver_quic.go

+ 4 - 0
app/dns/nameserver_doh.go

@@ -325,6 +325,10 @@ func (s *DoHNameServer) findIPsForDomain(domain string, option dns_feature.IPOpt
 		return nil, err6
 	}
 
+	if (option.IPv4Enable && record.A != nil) || (option.IPv6Enable && record.AAAA != nil) {
+		return nil, dns_feature.ErrEmptyResponse
+	}
+
 	return nil, errRecordNotFound
 }
 

+ 4 - 0
app/dns/nameserver_quic.go

@@ -262,6 +262,10 @@ func (s *QUICNameServer) findIPsForDomain(domain string, option dns_feature.IPOp
 		return nil, err6
 	}
 
+	if (option.IPv4Enable && record.A != nil) || (option.IPv6Enable && record.AAAA != nil) {
+		return nil, dns_feature.ErrEmptyResponse
+	}
+
 	return nil, errRecordNotFound
 }