mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-21 12:59:04 +00:00
Added VersionTLS constants and VersionName(version uint16) method that turns it into a string, copied from big go
This commit is contained in:
@@ -17,6 +17,37 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
VersionTLS10 = 0x0301
|
||||||
|
VersionTLS11 = 0x0302
|
||||||
|
VersionTLS12 = 0x0303
|
||||||
|
VersionTLS13 = 0x0304
|
||||||
|
|
||||||
|
// Deprecated: SSLv3 is cryptographically broken, and is no longer
|
||||||
|
// supported by this package. See golang.org/issue/32716.
|
||||||
|
VersionSSL30 = 0x0300
|
||||||
|
)
|
||||||
|
|
||||||
|
// VersionName returns the name for the provided TLS version number
|
||||||
|
// (e.g. "TLS 1.3"), or a fallback representation of the value if the
|
||||||
|
// version is not implemented by this package.
|
||||||
|
func VersionName(version uint16) string {
|
||||||
|
switch version {
|
||||||
|
case VersionSSL30:
|
||||||
|
return "SSLv3"
|
||||||
|
case VersionTLS10:
|
||||||
|
return "TLS 1.0"
|
||||||
|
case VersionTLS11:
|
||||||
|
return "TLS 1.1"
|
||||||
|
case VersionTLS12:
|
||||||
|
return "TLS 1.2"
|
||||||
|
case VersionTLS13:
|
||||||
|
return "TLS 1.3"
|
||||||
|
default:
|
||||||
|
return fmt.Sprintf("0x%04X", version)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// CurveID is the type of a TLS identifier for an elliptic curve. See
|
// CurveID is the type of a TLS identifier for an elliptic curve. See
|
||||||
// https://www.iana.org/assignments/tls-parameters/tls-parameters.xml#tls-parameters-8.
|
// https://www.iana.org/assignments/tls-parameters/tls-parameters.xml#tls-parameters-8.
|
||||||
//
|
//
|
||||||
|
|||||||
Reference in New Issue
Block a user