Standard library / crypto/tls

tls.VersionName()

Returns a readable TLS version name; unknown values are formatted numerically. Expected stdout: 'TLS 1.3\n'.

Formal Syntax & Structure

go syntaxgo
func VersionName(version uint16) string

Parameters & Attributes

NameTypeDescription
versionuint16Numeric TLS protocol version identifier.

Return Value

string

Result of the operation; handle any returned error before using other results.

Working Example

Example Snippetgo
package main
import (  "crypto/tls"  "fmt")
func main() { fmt.Println(tls.VersionName(tls.VersionTLS13)) }
func must[T any](v T, e error) T {  if e != nil {    panic(e)  }  return v}func check(e error) {  if e != nil {    panic(e)  }}
Go Reference