Report invalid DNS address early

This commit is contained in:
安容
2025-04-26 14:03:51 +08:00
committed by 世界
parent df36013d7d
commit e8a6ae0ac7
6 changed files with 21 additions and 0 deletions

View File

@@ -96,6 +96,9 @@ func NewHTTPS(ctx context.Context, logger log.ContextLogger, tag string, options
if serverAddr.Port == 0 {
serverAddr.Port = 443
}
if !serverAddr.IsValid() {
return nil, E.New("invalid server address: ", serverAddr)
}
return NewHTTPSRaw(
dns.NewTransportAdapterWithRemoteOptions(C.DNSTypeHTTPS, tag, options.RemoteDNSServerOptions),
logger,