Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added VersionTLS constants and VersionName(version uint16) method #4718

Merged
merged 1 commit into from
Jan 30, 2025

Conversation

mohrobati
Copy link

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)
	}
}

@mohrobati mohrobati changed the base branch from release to dev January 24, 2025 19:24
@deadprogram
Copy link
Member

@mohrobati could you please rebase this PR against the latest `dev`` branch so as to resolve the unrelated build failure. Thank you!

…t turns it into a string, copied from big go
@mohrobati
Copy link
Author

@mohrobati could you please rebase this PR against the latest `dev`` branch so as to resolve the unrelated build failure. Thank you!

Done, thanks!

@deadprogram
Copy link
Member

Thanks @mohrobati now merging.

@deadprogram deadprogram merged commit 2044f6f into tinygo-org:dev Jan 30, 2025
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

VersionTLS constants and VersionName(version uint16) are missing
2 participants