tlsconfig: move Clone into proper package

Signed-off-by: Stephen J Day <stephen.day@docker.com>
This commit is contained in:
Stephen J Day 2016-09-08 20:21:27 -07:00
parent cf58eb437c
commit 9d7be9df8f
5 changed files with 19 additions and 19 deletions

View file

@ -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
}

View file

@ -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()
}

View file

@ -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()
}

View file

@ -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,

View file

@ -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,