Signed-off-by: Daniel Nephin <dnephin@docker.com>
| ... | ... |
@@ -12,7 +12,6 @@ import ( |
| 12 | 12 |
"time" |
| 13 | 13 |
|
| 14 | 14 |
"github.com/docker/docker/api/types" |
| 15 |
- "github.com/docker/docker/pkg/tlsconfig" |
|
| 16 | 15 |
"github.com/docker/go-connections/sockets" |
| 17 | 16 |
"github.com/pkg/errors" |
| 18 | 17 |
"golang.org/x/net/context" |
| ... | ... |
@@ -115,7 +114,7 @@ func tlsDialWithDialer(dialer *net.Dialer, network, addr string, config *tls.Con |
| 115 | 115 |
// from the hostname we're connecting to. |
| 116 | 116 |
if config.ServerName == "" {
|
| 117 | 117 |
// Make a copy to avoid polluting argument or default. |
| 118 |
- config = tlsconfig.Clone(config) |
|
| 118 |
+ config = tlsConfigClone(config) |
|
| 119 | 119 |
config.ServerName = hostname |
| 120 | 120 |
} |
| 121 | 121 |
|
| 122 | 122 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,11 @@ |
| 0 |
+// +build go1.8 |
|
| 1 |
+ |
|
| 2 |
+package client |
|
| 3 |
+ |
|
| 4 |
+import "crypto/tls" |
|
| 5 |
+ |
|
| 6 |
+// tlsConfigClone returns a clone of tls.Config. This function is provided for |
|
| 7 |
+// compatibility for go1.7 that doesn't include this method in stdlib. |
|
| 8 |
+func tlsConfigClone(c *tls.Config) *tls.Config {
|
|
| 9 |
+ return c.Clone() |
|
| 10 |
+} |
| 0 | 11 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,33 @@ |
| 0 |
+// +build go1.7,!go1.8 |
|
| 1 |
+ |
|
| 2 |
+package client |
|
| 3 |
+ |
|
| 4 |
+import "crypto/tls" |
|
| 5 |
+ |
|
| 6 |
+// tlsConfigClone returns a clone of tls.Config. This function is provided for |
|
| 7 |
+// compatibility for go1.7 that doesn't include this method in stdlib. |
|
| 8 |
+func tlsConfigClone(c *tls.Config) *tls.Config {
|
|
| 9 |
+ return &tls.Config{
|
|
| 10 |
+ Rand: c.Rand, |
|
| 11 |
+ Time: c.Time, |
|
| 12 |
+ Certificates: c.Certificates, |
|
| 13 |
+ NameToCertificate: c.NameToCertificate, |
|
| 14 |
+ GetCertificate: c.GetCertificate, |
|
| 15 |
+ RootCAs: c.RootCAs, |
|
| 16 |
+ NextProtos: c.NextProtos, |
|
| 17 |
+ ServerName: c.ServerName, |
|
| 18 |
+ ClientAuth: c.ClientAuth, |
|
| 19 |
+ ClientCAs: c.ClientCAs, |
|
| 20 |
+ InsecureSkipVerify: c.InsecureSkipVerify, |
|
| 21 |
+ CipherSuites: c.CipherSuites, |
|
| 22 |
+ PreferServerCipherSuites: c.PreferServerCipherSuites, |
|
| 23 |
+ SessionTicketsDisabled: c.SessionTicketsDisabled, |
|
| 24 |
+ SessionTicketKey: c.SessionTicketKey, |
|
| 25 |
+ ClientSessionCache: c.ClientSessionCache, |
|
| 26 |
+ MinVersion: c.MinVersion, |
|
| 27 |
+ MaxVersion: c.MaxVersion, |
|
| 28 |
+ CurvePreferences: c.CurvePreferences, |
|
| 29 |
+ DynamicRecordSizingDisabled: c.DynamicRecordSizingDisabled, |
|
| 30 |
+ Renegotiation: c.Renegotiation, |
|
| 31 |
+ } |
|
| 32 |
+} |
| 0 | 33 |
deleted file mode 100644 |
| ... | ... |
@@ -1,11 +0,0 @@ |
| 1 |
-// +build go1.8 |
|
| 2 |
- |
|
| 3 |
-package tlsconfig |
|
| 4 |
- |
|
| 5 |
-import "crypto/tls" |
|
| 6 |
- |
|
| 7 |
-// Clone returns a clone of tls.Config. This function is provided for |
|
| 8 |
-// compatibility for go1.7 that doesn't include this method in stdlib. |
|
| 9 |
-func Clone(c *tls.Config) *tls.Config {
|
|
| 10 |
- return c.Clone() |
|
| 11 |
-} |
| 12 | 1 |
deleted file mode 100644 |
| ... | ... |
@@ -1,33 +0,0 @@ |
| 1 |
-// +build go1.7,!go1.8 |
|
| 2 |
- |
|
| 3 |
-package tlsconfig |
|
| 4 |
- |
|
| 5 |
-import "crypto/tls" |
|
| 6 |
- |
|
| 7 |
-// Clone returns a clone of tls.Config. This function is provided for |
|
| 8 |
-// compatibility for go1.7 that doesn't include this method in stdlib. |
|
| 9 |
-func Clone(c *tls.Config) *tls.Config {
|
|
| 10 |
- return &tls.Config{
|
|
| 11 |
- Rand: c.Rand, |
|
| 12 |
- Time: c.Time, |
|
| 13 |
- Certificates: c.Certificates, |
|
| 14 |
- NameToCertificate: c.NameToCertificate, |
|
| 15 |
- GetCertificate: c.GetCertificate, |
|
| 16 |
- RootCAs: c.RootCAs, |
|
| 17 |
- NextProtos: c.NextProtos, |
|
| 18 |
- ServerName: c.ServerName, |
|
| 19 |
- ClientAuth: c.ClientAuth, |
|
| 20 |
- ClientCAs: c.ClientCAs, |
|
| 21 |
- InsecureSkipVerify: c.InsecureSkipVerify, |
|
| 22 |
- CipherSuites: c.CipherSuites, |
|
| 23 |
- PreferServerCipherSuites: c.PreferServerCipherSuites, |
|
| 24 |
- SessionTicketsDisabled: c.SessionTicketsDisabled, |
|
| 25 |
- SessionTicketKey: c.SessionTicketKey, |
|
| 26 |
- ClientSessionCache: c.ClientSessionCache, |
|
| 27 |
- MinVersion: c.MinVersion, |
|
| 28 |
- MaxVersion: c.MaxVersion, |
|
| 29 |
- CurvePreferences: c.CurvePreferences, |
|
| 30 |
- DynamicRecordSizingDisabled: c.DynamicRecordSizingDisabled, |
|
| 31 |
- Renegotiation: c.Renegotiation, |
|
| 32 |
- } |
|
| 33 |
-} |