mirror of
https://github.com/daeuniverse/dae.git
synced 2025-07-12 16:59:38 +07:00
fix(dns): should reject with nx instead of 0.0.0.0 (#141)
This commit is contained in:
@ -409,11 +409,12 @@ func NewControlPlane(
|
||||
}
|
||||
return nil
|
||||
},
|
||||
NewCache: func(fqdn string, answers []dnsmessage.RR, deadline time.Time) (cache *DnsCache, err error) {
|
||||
NewCache: func(fqdn string, answers []dnsmessage.RR, deadline time.Time, originalDeadline time.Time) (cache *DnsCache, err error) {
|
||||
return &DnsCache{
|
||||
DomainBitmap: plane.routingMatcher.domainMatcher.MatchDomainBitmap(fqdn),
|
||||
Answer: answers,
|
||||
Deadline: deadline,
|
||||
DomainBitmap: plane.routingMatcher.domainMatcher.MatchDomainBitmap(fqdn),
|
||||
Answer: answers,
|
||||
Deadline: deadline,
|
||||
OriginalDeadline: originalDeadline,
|
||||
}, nil
|
||||
},
|
||||
BestDialerChooser: plane.chooseBestDnsDialer,
|
||||
@ -423,7 +424,9 @@ func NewControlPlane(
|
||||
return nil, err
|
||||
}
|
||||
// Refresh domain routing cache with new routing.
|
||||
if dnsCache != nil && len(dnsCache) > 0 {
|
||||
// FIXME: We temperarily disable it because we want to make change of DNS section take effects immediately.
|
||||
// TODO: Add change detection.
|
||||
if false && len(dnsCache) > 0 {
|
||||
for cacheKey, cache := range dnsCache {
|
||||
// Also refresh out-dated routing because kernel map items have no expiration.
|
||||
lastDot := strings.LastIndex(cacheKey, ".")
|
||||
@ -556,7 +559,7 @@ func (c *ControlPlane) ChooseDialTarget(outbound consts.OutboundIndex, dst netip
|
||||
if !outbound.IsReserved() && domain != "" {
|
||||
switch c.dialMode {
|
||||
case consts.DialMode_Domain:
|
||||
if cache := c.dnsController.LookupDnsRespCache(domain, common.AddrToDnsType(dst.Addr())); cache != nil {
|
||||
if cache := c.dnsController.LookupDnsRespCache(c.dnsController.cacheKey(domain, common.AddrToDnsType(dst.Addr())), true); cache != nil {
|
||||
// Has A/AAAA records. It is a real domain.
|
||||
dialMode = consts.DialMode_Domain
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user