@@ -17,15 +17,14 @@ import (
17
17
)
18
18
19
19
func toTLSVersion (version string ) uint16 {
20
- version = strings .TrimSpace (strings .ToLower (version ))
21
- switch version {
22
- case "tls10" :
20
+ switch strings .TrimSpace (strings .ToLower (version )) {
21
+ case "tlsv1.0" :
23
22
return tls .VersionTLS10
24
- case "tls11 " :
23
+ case "tlsv1.1 " :
25
24
return tls .VersionTLS11
26
- case "tls12 " :
25
+ case "tlsv1.2 " :
27
26
return tls .VersionTLS12
28
- case "tls13 " :
27
+ case "tlsv1.3 " :
29
28
return tls .VersionTLS13
30
29
default :
31
30
log .Warn ("Unknown tls version: %s" , version )
@@ -36,9 +35,8 @@ func toTLSVersion(version string) uint16 {
36
35
func toCurvePreferences (preferences []string ) []tls.CurveID {
37
36
ids := make ([]tls.CurveID , 0 , len (preferences ))
38
37
for _ , pref := range preferences {
39
- pref = strings .TrimSpace (strings .ToLower (pref ))
40
38
var id tls.CurveID
41
- switch pref {
39
+ switch strings . TrimSpace ( strings . ToLower ( pref )) {
42
40
case "x25519" :
43
41
id = tls .X25519
44
42
case "p256" :
@@ -60,9 +58,8 @@ func toCurvePreferences(preferences []string) []tls.CurveID {
60
58
func toTLSCiphers (cipherStrings []string ) []uint16 {
61
59
ciphers := make ([]uint16 , 0 , len (cipherStrings ))
62
60
for _ , cipherString := range cipherStrings {
63
- cipherString = strings .TrimSpace (strings .ToLower (cipherString ))
64
61
var cipher uint16
65
- switch cipherString {
62
+ switch strings . TrimSpace ( strings . ToLower ( cipherString )) {
66
63
case "rsa_with_rc4_128_sha" :
67
64
cipher = tls .TLS_RSA_WITH_RC4_128_SHA
68
65
case "rsa_with_3des_ede_cbc_sha" :
0 commit comments