1
0
mirror of https://github.com/daeuniverse/dae.git synced 2025-01-13 00:04:47 +07:00

optimize(dns): use different ID for another lookup in ipversion prefer mode

This commit is contained in:
mzz2017 2023-04-07 23:13:10 +08:00
parent 38cc66d1d3
commit 066e856163
2 changed files with 4 additions and 0 deletions

View File

@ -17,10 +17,12 @@ import (
"github.com/daeuniverse/dae/component/outbound/dialer"
"github.com/mohae/deepcopy"
"github.com/mzz2017/softwind/netproxy"
"github.com/mzz2017/softwind/pkg/fastrand"
"github.com/mzz2017/softwind/pool"
"github.com/sirupsen/logrus"
"golang.org/x/net/dns/dnsmessage"
"io"
"math"
"net"
"net/netip"
"strings"
@ -369,6 +371,7 @@ func (c *DnsController) Handle_(dnsMessage *dnsmessage.Message, req *udpRequest)
// Try to make both A and AAAA lookups.
dnsMessage2 := deepcopy.Copy(dnsMessage).(*dnsmessage.Message)
dnsMessage2.ID = uint16(fastrand.Intn(math.MaxUint16))
var qtype2 dnsmessage.Type
switch qtype {
case dnsmessage.TypeA:

View File

@ -81,6 +81,7 @@ node {
dns {
# For example, if ipversion_prefer is 4 and the domain name has both type A and type AAAA records, the dae will only respond to type A queries and response empty answer to type AAAA queries.
#ipversion_prefer: 4
upstream {
# Value can be scheme://host:port, where the scheme can be tcp/udp/tcp+udp.
# If host is a domain and has both IPv4 and IPv6 record, dae will automatically choose