forked from ClusterLabs/hawk-apiserver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tls_clone_legacy.go
34 lines (31 loc) · 1.11 KB
/
tls_clone_legacy.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// +build !go1.8
package main
import "crypto/tls"
// cloneTLSConfig
//
// tls.Config.Clone() was added in go 1.8, so
// use this func in older versions.
func cloneTLSConfig(config *tls.Config) *tls.Config {
if config != nil {
return &tls.Config{
Rand: config.Rand,
Time: config.Time,
Certificates: config.Certificates,
NameToCertificate: config.NameToCertificate,
GetCertificate: config.GetCertificate,
RootCAs: config.RootCAs,
NextProtos: config.NextProtos,
ServerName: config.ServerName,
ClientAuth: config.ClientAuth,
ClientCAs: config.ClientCAs,
InsecureSkipVerify: config.InsecureSkipVerify,
CipherSuites: config.CipherSuites,
PreferServerCipherSuites: config.PreferServerCipherSuites,
ClientSessionCache: config.ClientSessionCache,
MinVersion: config.MinVersion,
MaxVersion: config.MaxVersion,
CurvePreferences: config.CurvePreferences,
}
}
return &tls.Config{}
}