File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,26 @@ const (
4242 VersionSSL30 = 0x0300
4343)
4444
45+ // VersionName returns the name for the provided TLS version number
46+ // (e.g. "TLS 1.3"), or a fallback representation of the value if the
47+ // version is not implemented by this package.
48+ func VersionName (version uint16 ) string {
49+ switch version {
50+ case VersionSSL30 :
51+ return "SSLv3"
52+ case VersionTLS10 :
53+ return "TLS 1.0"
54+ case VersionTLS11 :
55+ return "TLS 1.1"
56+ case VersionTLS12 :
57+ return "TLS 1.2"
58+ case VersionTLS13 :
59+ return "TLS 1.3"
60+ default :
61+ return fmt .Sprintf ("0x%04X" , version )
62+ }
63+ }
64+
4565const (
4666 maxPlaintext = 16384 // maximum plaintext payload length
4767 maxCiphertext = 16384 + 2048 // maximum ciphertext payload length
You can’t perform that action at this time.
0 commit comments