Report invalid DNS address early

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

View File

@@ -93,7 +93,9 @@ func NewHTTPS(ctx context.Context, logger log.ContextLogger, tag string, options
return nil, err
}
serverAddr := options.DNSServerAddressOptions.Build()
if serverAddr.Port == 0 {
if !serverAddr.Addr.IsValid() {
return nil, E.New("invalid server address: ", serverAddr)
} else if serverAddr.Port == 0 {
serverAddr.Port = 443
}
return NewHTTPSRaw(