瀏覽代碼

Move tlsconfig to client package.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Daniel Nephin 8 年之前
父節點
當前提交
6916c215b0
共有 4 個文件被更改,包括 15 次插入16 次删除
  1. 1 2
      client/hijack.go
  2. 11 0
      client/tlsconfig_clone.go
  3. 3 3
      client/tlsconfig_clone_go17.go
  4. 0 11
      pkg/tlsconfig/tlsconfig_clone.go

+ 1 - 2
client/hijack.go

@@ -12,7 +12,6 @@ import (
 	"time"
 	"time"
 
 
 	"github.com/docker/docker/api/types"
 	"github.com/docker/docker/api/types"
-	"github.com/docker/docker/pkg/tlsconfig"
 	"github.com/docker/go-connections/sockets"
 	"github.com/docker/go-connections/sockets"
 	"github.com/pkg/errors"
 	"github.com/pkg/errors"
 	"golang.org/x/net/context"
 	"golang.org/x/net/context"
@@ -115,7 +114,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 = tlsconfig.Clone(config)
+		config = tlsConfigClone(config)
 		config.ServerName = hostname
 		config.ServerName = hostname
 	}
 	}
 
 

+ 11 - 0
client/tlsconfig_clone.go

@@ -0,0 +1,11 @@
+// +build go1.8
+
+package client
+
+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()
+}

+ 3 - 3
pkg/tlsconfig/tlsconfig_clone_go17.go → client/tlsconfig_clone_go17.go

@@ -1,12 +1,12 @@
 // +build go1.7,!go1.8
 // +build go1.7,!go1.8
 
 
-package tlsconfig
+package client
 
 
 import "crypto/tls"
 import "crypto/tls"
 
 
-// Clone returns a clone of tls.Config. This function is provided for
+// tlsConfigClone returns a clone of tls.Config. This function is provided for
 // compatibility for go1.7 that doesn't include this method in stdlib.
 // compatibility for go1.7 that doesn't include this method in stdlib.
-func Clone(c *tls.Config) *tls.Config {
+func tlsConfigClone(c *tls.Config) *tls.Config {
 	return &tls.Config{
 	return &tls.Config{
 		Rand:                        c.Rand,
 		Rand:                        c.Rand,
 		Time:                        c.Time,
 		Time:                        c.Time,

+ 0 - 11
pkg/tlsconfig/tlsconfig_clone.go

@@ -1,11 +0,0 @@
-// +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()
-}