mirror of https://github.com/docker/cli.git
tlsconfig: move Clone into proper package
Signed-off-by: Stephen J Day <stephen.day@docker.com>
This commit is contained in:
parent
450b3123e3
commit
c6f96cb8b4
|
@ -11,7 +11,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
"github.com/docker/docker/client/transport"
|
"github.com/docker/docker/pkg/tlsconfig"
|
||||||
"github.com/docker/go-connections/sockets"
|
"github.com/docker/go-connections/sockets"
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
)
|
)
|
||||||
|
@ -136,7 +136,7 @@ func tlsDialWithDialer(dialer *net.Dialer, network, addr string, config *tls.Con
|
||||||
// from the hostname we're connecting to.
|
// from the hostname we're connecting to.
|
||||||
if config.ServerName == "" {
|
if config.ServerName == "" {
|
||||||
// Make a copy to avoid polluting argument or default.
|
// Make a copy to avoid polluting argument or default.
|
||||||
config = transport.TLSConfigClone(config)
|
config = tlsconfig.Clone(config)
|
||||||
config.ServerName = hostname
|
config.ServerName = hostname
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
// +build go1.8
|
|
||||||
|
|
||||||
package transport
|
|
||||||
|
|
||||||
import "crypto/tls"
|
|
||||||
|
|
||||||
// TLSConfigClone returns a clone of tls.Config. This function is provided for
|
|
||||||
// compatibility for go1.7 that doesn't include this method in stdlib.
|
|
||||||
func TLSConfigClone(c *tls.Config) *tls.Config {
|
|
||||||
return c.Clone()
|
|
||||||
}
|
|
|
@ -1,31 +0,0 @@
|
||||||
// +build go1.6,!go1.7
|
|
||||||
|
|
||||||
package transport
|
|
||||||
|
|
||||||
import "crypto/tls"
|
|
||||||
|
|
||||||
// TLSConfigClone returns a clone of tls.Config. This function is provided for
|
|
||||||
// compatibility for go1.6 that doesn't include this method in stdlib.
|
|
||||||
func TLSConfigClone(c *tls.Config) *tls.Config {
|
|
||||||
return &tls.Config{
|
|
||||||
Rand: c.Rand,
|
|
||||||
Time: c.Time,
|
|
||||||
Certificates: c.Certificates,
|
|
||||||
NameToCertificate: c.NameToCertificate,
|
|
||||||
GetCertificate: c.GetCertificate,
|
|
||||||
RootCAs: c.RootCAs,
|
|
||||||
NextProtos: c.NextProtos,
|
|
||||||
ServerName: c.ServerName,
|
|
||||||
ClientAuth: c.ClientAuth,
|
|
||||||
ClientCAs: c.ClientCAs,
|
|
||||||
InsecureSkipVerify: c.InsecureSkipVerify,
|
|
||||||
CipherSuites: c.CipherSuites,
|
|
||||||
PreferServerCipherSuites: c.PreferServerCipherSuites,
|
|
||||||
SessionTicketsDisabled: c.SessionTicketsDisabled,
|
|
||||||
SessionTicketKey: c.SessionTicketKey,
|
|
||||||
ClientSessionCache: c.ClientSessionCache,
|
|
||||||
MinVersion: c.MinVersion,
|
|
||||||
MaxVersion: c.MaxVersion,
|
|
||||||
CurvePreferences: c.CurvePreferences,
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,33 +0,0 @@
|
||||||
// +build go1.7,!go1.8
|
|
||||||
|
|
||||||
package transport
|
|
||||||
|
|
||||||
import "crypto/tls"
|
|
||||||
|
|
||||||
// TLSConfigClone returns a clone of tls.Config. This function is provided for
|
|
||||||
// compatibility for go1.7 that doesn't include this method in stdlib.
|
|
||||||
func TLSConfigClone(c *tls.Config) *tls.Config {
|
|
||||||
return &tls.Config{
|
|
||||||
Rand: c.Rand,
|
|
||||||
Time: c.Time,
|
|
||||||
Certificates: c.Certificates,
|
|
||||||
NameToCertificate: c.NameToCertificate,
|
|
||||||
GetCertificate: c.GetCertificate,
|
|
||||||
RootCAs: c.RootCAs,
|
|
||||||
NextProtos: c.NextProtos,
|
|
||||||
ServerName: c.ServerName,
|
|
||||||
ClientAuth: c.ClientAuth,
|
|
||||||
ClientCAs: c.ClientCAs,
|
|
||||||
InsecureSkipVerify: c.InsecureSkipVerify,
|
|
||||||
CipherSuites: c.CipherSuites,
|
|
||||||
PreferServerCipherSuites: c.PreferServerCipherSuites,
|
|
||||||
SessionTicketsDisabled: c.SessionTicketsDisabled,
|
|
||||||
SessionTicketKey: c.SessionTicketKey,
|
|
||||||
ClientSessionCache: c.ClientSessionCache,
|
|
||||||
MinVersion: c.MinVersion,
|
|
||||||
MaxVersion: c.MaxVersion,
|
|
||||||
CurvePreferences: c.CurvePreferences,
|
|
||||||
DynamicRecordSizingDisabled: c.DynamicRecordSizingDisabled,
|
|
||||||
Renegotiation: c.Renegotiation,
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue