From 9d7be9df8f79b26a4b9778851cf19a6579f8bc61 Mon Sep 17 00:00:00 2001 From: Stephen J Day Date: Thu, 8 Sep 2016 20:21:27 -0700 Subject: [PATCH] tlsconfig: move Clone into proper package Signed-off-by: Stephen J Day --- client/hijack.go | 4 ++-- client/transport/tlsconfig_clone.go | 11 ----------- pkg/tlsconfig/tlsconfig_clone.go | 11 +++++++++++ .../tlsconfig}/tlsconfig_clone_go16.go | 6 +++--- .../tlsconfig}/tlsconfig_clone_go17.go | 6 +++--- 5 files changed, 19 insertions(+), 19 deletions(-) delete mode 100644 client/transport/tlsconfig_clone.go create mode 100644 pkg/tlsconfig/tlsconfig_clone.go rename {client/transport => pkg/tlsconfig}/tlsconfig_clone_go16.go (87%) rename {client/transport => pkg/tlsconfig}/tlsconfig_clone_go17.go (88%) diff --git a/client/hijack.go b/client/hijack.go index 9376d21b97..e3f63e20c2 100644 --- a/client/hijack.go +++ b/client/hijack.go @@ -11,7 +11,7 @@ import ( "time" "github.com/docker/docker/api/types" - "github.com/docker/docker/client/transport" + "github.com/docker/docker/pkg/tlsconfig" "github.com/docker/go-connections/sockets" "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. if config.ServerName == "" { // Make a copy to avoid polluting argument or default. - config = transport.TLSConfigClone(config) + config = tlsconfig.Clone(config) config.ServerName = hostname } diff --git a/client/transport/tlsconfig_clone.go b/client/transport/tlsconfig_clone.go deleted file mode 100644 index 034bc01d33..0000000000 --- a/client/transport/tlsconfig_clone.go +++ /dev/null @@ -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() -} diff --git a/pkg/tlsconfig/tlsconfig_clone.go b/pkg/tlsconfig/tlsconfig_clone.go new file mode 100644 index 0000000000..e4dec3a5d1 --- /dev/null +++ b/pkg/tlsconfig/tlsconfig_clone.go @@ -0,0 +1,11 @@ +// +build go1.8 + +package tlsconfig + +import "crypto/tls" + +// Clone returns a clone of tls.Config. This function is provided for +// compatibility for go1.7 that doesn't include this method in stdlib. +func Clone(c *tls.Config) *tls.Config { + return c.Clone() +} diff --git a/client/transport/tlsconfig_clone_go16.go b/pkg/tlsconfig/tlsconfig_clone_go16.go similarity index 87% rename from client/transport/tlsconfig_clone_go16.go rename to pkg/tlsconfig/tlsconfig_clone_go16.go index 12f13e4694..0b816650ec 100644 --- a/client/transport/tlsconfig_clone_go16.go +++ b/pkg/tlsconfig/tlsconfig_clone_go16.go @@ -1,12 +1,12 @@ // +build go1.6,!go1.7 -package transport +package tlsconfig import "crypto/tls" -// TLSConfigClone returns a clone of tls.Config. This function is provided for +// Clone 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 { +func Clone(c *tls.Config) *tls.Config { return &tls.Config{ Rand: c.Rand, Time: c.Time, diff --git a/client/transport/tlsconfig_clone_go17.go b/pkg/tlsconfig/tlsconfig_clone_go17.go similarity index 88% rename from client/transport/tlsconfig_clone_go17.go rename to pkg/tlsconfig/tlsconfig_clone_go17.go index 50bf389e43..0d5b448fec 100644 --- a/client/transport/tlsconfig_clone_go17.go +++ b/pkg/tlsconfig/tlsconfig_clone_go17.go @@ -1,12 +1,12 @@ // +build go1.7,!go1.8 -package transport +package tlsconfig import "crypto/tls" -// TLSConfigClone returns a clone of tls.Config. This function is provided for +// Clone 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 { +func Clone(c *tls.Config) *tls.Config { return &tls.Config{ Rand: c.Rand, Time: c.Time,