1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-06-28 02:05:23 +00:00

send IPv6 query only to supported server.

This commit is contained in:
Darien Raymond 2017-11-19 20:42:34 +01:00
parent 878d412c6a
commit 8fb69fc2b6
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

View File

@ -22,6 +22,12 @@ const (
var ( var (
pseudoDestination = net.UDPDestination(net.LocalHostIP, net.Port(53)) pseudoDestination = net.UDPDestination(net.LocalHostIP, net.Port(53))
multiQuestionDns = map[net.Address]bool{
net.IPAddress([]byte{8, 8, 8, 8}): true,
net.IPAddress([]byte{8, 8, 4, 4}): true,
net.IPAddress([]byte{9, 9, 9, 9}): true,
}
) )
type ARecord struct { type ARecord struct {
@ -150,12 +156,14 @@ func (v *UDPNameServer) BuildQueryA(domain string, id uint16) *buf.Buffer {
Name: dns.Fqdn(domain), Name: dns.Fqdn(domain),
Qtype: dns.TypeA, Qtype: dns.TypeA,
Qclass: dns.ClassINET, Qclass: dns.ClassINET,
}, }}
{ if multiQuestionDns[v.address.Address] {
msg.Question = append(msg.Question, dns.Question{
Name: dns.Fqdn(domain), Name: dns.Fqdn(domain),
Qtype: dns.TypeAAAA, Qtype: dns.TypeAAAA,
Qclass: dns.ClassINET, Qclass: dns.ClassINET,
}} })
}
buffer := buf.New() buffer := buf.New()
common.Must(buffer.Reset(func(b []byte) (int, error) { common.Must(buffer.Reset(func(b []byte) (int, error) {