Fix DNS route suffix matching

This commit is contained in:
世界
2026-07-19 17:09:35 +08:00
parent 3d2461f3ba
commit 77d9c07d2f
2 changed files with 4 additions and 5 deletions
+2 -3
View File
@@ -6,7 +6,6 @@ import (
"context"
"net/netip"
"os"
"strings"
"sync"
"sync/atomic"
"time"
@@ -202,7 +201,7 @@ func (t *Transport) PreferredDomain(domain string) bool {
if linkDomain.Domain == "." {
continue
}
if strings.HasSuffix(domain, linkDomain.Domain) {
if mDNS.IsSubDomain(linkDomain.Domain, domain) {
return true
}
}
@@ -234,7 +233,7 @@ func (t *Transport) ExchangeAsync(ctx context.Context, message *mDNS.Msg, callba
if domain.Domain == "." && domain.RoutingOnly && !t.acceptDefaultResolvers {
continue
}
if strings.HasSuffix(question.Name, domain.Domain) {
if mDNS.IsSubDomain(domain.Domain, question.Name) {
selectedLink = link
}
}