mirror of
				https://github.com/moby/moby.git
				synced 2022-11-09 12:21:53 -05:00 
			
		
		
		
	tlsconfig: move Clone into proper package
Signed-off-by: Stephen J Day <stephen.day@docker.com>
This commit is contained in:
		
							parent
							
								
									cf58eb437c
								
							
						
					
					
						commit
						9d7be9df8f
					
				
					 5 changed files with 19 additions and 19 deletions
				
			
		| 
						 | 
				
			
			@ -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
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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()
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										11
									
								
								pkg/tlsconfig/tlsconfig_clone.go
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								pkg/tlsconfig/tlsconfig_clone.go
									
										
									
									
									
										Normal 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()
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -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,
 | 
			
		||||
| 
						 | 
				
			
			@ -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,
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue