Fix panic in etcd validate secure endpoints #13810

`ValidateSecureEndpoints()` should call `t.DialContext()` instead of `t.Dial()`, because `t.Dial` is `nil`
This commit is contained in:
EXEC
2022-03-19 17:48:30 +08:00
committed by eval-exec
parent 3254125e6c
commit bd7d09255b

View File

@@ -15,6 +15,7 @@
package transport
import (
"context"
"fmt"
"strings"
"time"
@@ -34,7 +35,7 @@ func ValidateSecureEndpoints(tlsInfo TLSInfo, eps []string) ([]string, error) {
errs = append(errs, fmt.Sprintf("%q is insecure", ep))
continue
}
conn, cerr := t.Dial("tcp", ep[len("https://"):])
conn, cerr := t.DialContext(context.Background(), "tcp", ep[len("https://"):])
if cerr != nil {
errs = append(errs, fmt.Sprintf("%q failed to dial (%v)", ep, cerr))
continue