mirror of
https://github.com/securego/gosec.git
synced 2024-12-26 04:25:52 +00:00
df484bfa9e
* cmd/tlsconfig: build tags to deprecate tls.VersionSSL30 from go1.14 * cmd/tlsconfig: build tags to turn off TLSv1.3 in go1.11
31 lines
629 B
Go
31 lines
629 B
Go
// +build !go1.12
|
|
|
|
// This file can be removed once go1.11 is no longer supported
|
|
|
|
package main
|
|
|
|
import (
|
|
"crypto/tls"
|
|
"sort"
|
|
)
|
|
|
|
func mapTLSVersions(tlsVersions []string) []int {
|
|
var versions []int
|
|
for _, tlsVersion := range tlsVersions {
|
|
switch tlsVersion {
|
|
case "TLSv1.2":
|
|
versions = append(versions, tls.VersionTLS12)
|
|
case "TLSv1.1":
|
|
versions = append(versions, tls.VersionTLS11)
|
|
case "TLSv1":
|
|
versions = append(versions, tls.VersionTLS10)
|
|
case "SSLv3":
|
|
// unsupported from go1.14
|
|
versions = append(versions, tls.VersionSSL30)
|
|
default:
|
|
continue
|
|
}
|
|
}
|
|
sort.Ints(versions)
|
|
return versions
|
|
}
|