mirror of
https://github.com/mjl-/mox.git
synced 2025-06-28 02:28:15 +03:00
21 lines
480 B
Go
21 lines
480 B
Go
package moxio
|
|
|
|
import (
|
|
"crypto/tls"
|
|
"strings"
|
|
)
|
|
|
|
// TLSInfo returns human-readable strings about the TLS connection, for use in
|
|
// logging.
|
|
func TLSInfo(cs tls.ConnectionState) (version, ciphersuite string) {
|
|
// e.g. tls1.3, instead of "TLS 1.3"
|
|
version = tls.VersionName(cs.Version)
|
|
version = strings.ToLower(version)
|
|
version = strings.ReplaceAll(version, " ", "")
|
|
|
|
ciphersuite = tls.CipherSuiteName(cs.CipherSuite)
|
|
ciphersuite = strings.ToLower(ciphersuite)
|
|
|
|
return
|
|
}
|