Make domain_resolver optional when only one DNS server is configured

This commit is contained in:
世界 2025-03-15 10:12:10 +08:00
parent f46df03695
commit 06f25876b3
No known key found for this signature in database
GPG key ID: CD109927C34A63C4
4 changed files with 22 additions and 2 deletions

View file

@ -104,7 +104,12 @@ func NewWithOptions(options Options) (N.Dialer, error) {
} else if options.NewDialer {
return nil, E.New("missing domain resolver for domain server address")
} else {
deprecated.Report(options.Context, deprecated.OptionMissingDomainResolver)
transports := dnsTransport.Transports()
if len(transports) < 2 {
dnsQueryOptions.Transport = dnsTransport.Default()
} else {
deprecated.Report(options.Context, deprecated.OptionMissingDomainResolver)
}
}
dialer = NewResolveDialer(
options.Context,