traefik/pkg/tls/version.go

21 lines
435 B
Go
Raw Normal View History

package tls
import "crypto/tls"
2021-01-20 03:08:03 +00:00
// GetVersion returns the normalized TLS version.
// Available TLS versions defined at https://golang.org/pkg/crypto/tls/#pkg-constants
2021-01-20 03:08:03 +00:00
func GetVersion(connState *tls.ConnectionState) string {
switch connState.Version {
case tls.VersionTLS10:
return "1.0"
case tls.VersionTLS11:
return "1.1"
case tls.VersionTLS12:
return "1.2"
case tls.VersionTLS13:
return "1.3"
}
return "unknown"
}