mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 20:24:09 +00:00
Check error return from closing connection
This commit is contained in:
parent
d11374d330
commit
7bafa7d8f5
@ -19,6 +19,7 @@ package cert
|
|||||||
import (
|
import (
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"crypto/x509"
|
"crypto/x509"
|
||||||
|
"fmt"
|
||||||
"net/url"
|
"net/url"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
@ -43,7 +44,9 @@ func GetClientCANames(apiHost string) ([]string, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
defer conn.Close()
|
if err := conn.Close(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
return acceptableCAs, nil
|
return acceptableCAs, nil
|
||||||
}
|
}
|
||||||
@ -72,7 +75,9 @@ func GetServingCertificates(apiHost, serverName string) ([]*x509.Certificate, []
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
conn.Close()
|
if err = conn.Close(); err != nil {
|
||||||
|
return nil, nil, fmt.Errorf("failed to close connection : %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
peerCerts := conn.ConnectionState().PeerCertificates
|
peerCerts := conn.ConnectionState().PeerCertificates
|
||||||
peerCertBytes := [][]byte{}
|
peerCertBytes := [][]byte{}
|
||||||
|
Loading…
Reference in New Issue
Block a user