@@ -40,23 +40,23 @@ func WithTLSData(s store.Reader, contextName string, m EndpointMeta) (Endpoint,
4040}
4141
4242// tlsConfig extracts a context docker endpoint TLS config
43- func (c * Endpoint ) tlsConfig () (* tls.Config , error ) {
44- if c .TLSData == nil && ! c .SkipTLSVerify {
43+ func (ep * Endpoint ) tlsConfig () (* tls.Config , error ) {
44+ if ep .TLSData == nil && ! ep .SkipTLSVerify {
4545 // there is no specific tls config
4646 return nil , nil
4747 }
4848 var tlsOpts []func (* tls.Config )
49- if c .TLSData != nil && c .TLSData .CA != nil {
49+ if ep .TLSData != nil && ep .TLSData .CA != nil {
5050 certPool := x509 .NewCertPool ()
51- if ! certPool .AppendCertsFromPEM (c .TLSData .CA ) {
51+ if ! certPool .AppendCertsFromPEM (ep .TLSData .CA ) {
5252 return nil , errors .New ("failed to retrieve context tls info: ca.pem seems invalid" )
5353 }
5454 tlsOpts = append (tlsOpts , func (cfg * tls.Config ) {
5555 cfg .RootCAs = certPool
5656 })
5757 }
58- if c .TLSData != nil && c .TLSData .Key != nil && c .TLSData .Cert != nil {
59- keyBytes := c .TLSData .Key
58+ if ep .TLSData != nil && ep .TLSData .Key != nil && ep .TLSData .Cert != nil {
59+ keyBytes := ep .TLSData .Key
6060 pemBlock , _ := pem .Decode (keyBytes )
6161 if pemBlock == nil {
6262 return nil , errors .New ("no valid private key found" )
@@ -65,15 +65,15 @@ func (c *Endpoint) tlsConfig() (*tls.Config, error) {
6565 return nil , errors .New ("private key is encrypted - support for encrypted private keys has been removed, see https://docs.docker.com/go/deprecated/" )
6666 }
6767
68- x509cert , err := tls .X509KeyPair (c .TLSData .Cert , keyBytes )
68+ x509cert , err := tls .X509KeyPair (ep .TLSData .Cert , keyBytes )
6969 if err != nil {
7070 return nil , errors .Wrap (err , "failed to retrieve context tls info" )
7171 }
7272 tlsOpts = append (tlsOpts , func (cfg * tls.Config ) {
7373 cfg .Certificates = []tls.Certificate {x509cert }
7474 })
7575 }
76- if c .SkipTLSVerify {
76+ if ep .SkipTLSVerify {
7777 tlsOpts = append (tlsOpts , func (cfg * tls.Config ) {
7878 cfg .InsecureSkipVerify = true
7979 })
@@ -82,21 +82,21 @@ func (c *Endpoint) tlsConfig() (*tls.Config, error) {
8282}
8383
8484// ClientOpts returns a slice of Client options to configure an API client with this endpoint
85- func (c * Endpoint ) ClientOpts () ([]client.Opt , error ) {
85+ func (ep * Endpoint ) ClientOpts () ([]client.Opt , error ) {
8686 var result []client.Opt
87- if c .Host != "" {
88- helper , err := connhelper .GetConnectionHelper (c .Host )
87+ if ep .Host != "" {
88+ helper , err := connhelper .GetConnectionHelper (ep .Host )
8989 if err != nil {
9090 return nil , err
9191 }
9292 if helper == nil {
93- tlsConfig , err := c .tlsConfig ()
93+ tlsConfig , err := ep .tlsConfig ()
9494 if err != nil {
9595 return nil , err
9696 }
9797 result = append (result ,
9898 withHTTPClient (tlsConfig ),
99- client .WithHost (c .Host ),
99+ client .WithHost (ep .Host ),
100100 )
101101
102102 } else {
0 commit comments