-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathtls_1.4.go
46 lines (41 loc) · 1.21 KB
/
tls_1.4.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
35
36
37
38
39
40
41
42
43
44
45
46
// Copyright 2016 struktur AG. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build go1.2,!go1.5
package phoenix
import (
"crypto/tls"
)
func setTLSMinVersion(config Config, section string, tlsConfig *tls.Config) {
// Default to TLSv1.2.
minVersion := tls.VersionTLS12
minVersionString, err := config.GetString(section, "minVersion")
if err == nil {
switch minVersionString {
case "SSLv3":
minVersion = tls.VersionSSL30
case "TLSv1":
minVersion = tls.VersionTLS10
case "TLSv1.1":
minVersion = tls.VersionTLS11
case "TLSv1.2":
minVersion = tls.VersionTLS12
}
}
tlsConfig.MinVersion = uint16(minVersion)
}
func makeDefaultCipherSuites() []uint16 {
// Default cipher suites - no RC4.
return []uint16{
tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,
tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,
tls.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,
tls.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,
tls.TLS_RSA_WITH_AES_128_CBC_SHA,
tls.TLS_RSA_WITH_AES_256_CBC_SHA,
tls.TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA,
tls.TLS_RSA_WITH_3DES_EDE_CBC_SHA,
}
}