2021-01-19 08:52:06 +00:00
|
|
|
package tls
|
|
|
|
|
|
|
|
import "crypto/tls"
|
|
|
|
|
2021-01-20 03:08:03 +00:00
|
|
|
// GetVersion returns the normalized TLS version.
|
2021-09-10 09:42:07 +00:00
|
|
|
// Available TLS versions defined at https://pkg.go.dev/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"
|
2021-01-19 08:52:06 +00:00
|
|
|
}
|