traefik/pkg/tls/version.go
2021-01-20 04:08:03 +01:00

20 lines
435 B
Go

package tls
import "crypto/tls"
// GetVersion returns the normalized TLS version.
// Available TLS versions defined at https://golang.org/pkg/crypto/tls/#pkg-constants
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"
}