gosec/cmd/tlsconfig/tls_version.go
Cosmin Cojocar 607d607b51
Enable Go 1.18 in the ci and release workflows
* Enable Go 1.18 in the ci and release workflows

* Fix lint warning

* Add golangci as a make target
2022-03-21 16:53:22 +01:00

26 lines
518 B
Go

package main
import (
"crypto/tls"
"sort"
)
func mapTLSVersions(tlsVersions []string) []int {
var versions []int
for _, tlsVersion := range tlsVersions {
switch tlsVersion {
case "TLSv1.3":
versions = append(versions, tls.VersionTLS13)
case "TLSv1.2":
versions = append(versions, tls.VersionTLS12)
case "TLSv1.1":
versions = append(versions, tls.VersionTLS11)
case "TLSv1":
versions = append(versions, tls.VersionTLS10)
default:
continue
}
}
sort.Ints(versions)
return versions
}