Files
2025-03-06 11:36:33 +01:00

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
}