Browse Source

Fix: response AAAA records in TypeA query (#1235)

秋のかえで 4 years ago
parent
commit
50bcb6831c
4 changed files with 16 additions and 16 deletions
  1. 4 4
      app/dns/nameserver_doh.go
  2. 4 4
      app/dns/nameserver_quic.go
  3. 4 4
      app/dns/nameserver_tcp.go
  4. 4 4
      app/dns/nameserver_udp.go

+ 4 - 4
app/dns/nameserver_doh.go

@@ -304,11 +304,11 @@ func (s *DoHNameServer) findIPsForDomain(domain string, option dns_feature.IPOpt
 	var ips []net.Address
 	var ip6 []net.Address
 
-	switch {
-	case option.IPv4Enable:
+	if option.IPv4Enable {
 		ips, err4 = record.A.getIPs()
-		fallthrough
-	case option.IPv6Enable:
+	}
+
+	if option.IPv6Enable {
 		ip6, err6 = record.AAAA.getIPs()
 		ips = append(ips, ip6...)
 	}

+ 4 - 4
app/dns/nameserver_quic.go

@@ -241,11 +241,11 @@ func (s *QUICNameServer) findIPsForDomain(domain string, option dns_feature.IPOp
 	var ips []net.Address
 	var ip6 []net.Address
 
-	switch {
-	case option.IPv4Enable:
+	if option.IPv4Enable {
 		ips, err4 = record.A.getIPs()
-		fallthrough
-	case option.IPv6Enable:
+	}
+
+	if option.IPv6Enable {
 		ip6, err6 = record.AAAA.getIPs()
 		ips = append(ips, ip6...)
 	}

+ 4 - 4
app/dns/nameserver_tcp.go

@@ -283,11 +283,11 @@ func (s *TCPNameServer) findIPsForDomain(domain string, option dns_feature.IPOpt
 	var ips []net.Address
 	var ip6 []net.Address
 
-	switch {
-	case option.IPv4Enable:
+	if option.IPv4Enable {
 		ips, err4 = record.A.getIPs()
-		fallthrough
-	case option.IPv6Enable:
+	}
+
+	if option.IPv6Enable {
 		ip6, err6 = record.AAAA.getIPs()
 		ips = append(ips, ip6...)
 	}

+ 4 - 4
app/dns/nameserver_udp.go

@@ -223,11 +223,11 @@ func (s *ClassicNameServer) findIPsForDomain(domain string, option dns_feature.I
 	var ips []net.Address
 	var ip6 []net.Address
 
-	switch {
-	case option.IPv4Enable:
+	if option.IPv4Enable {
 		ips, err4 = record.A.getIPs()
-		fallthrough
-	case option.IPv6Enable:
+	}
+
+	if option.IPv6Enable {
 		ip6, err6 = record.AAAA.getIPs()
 		ips = append(ips, ip6...)
 	}