-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
crypto/tls: add VersionName function to return a string version of the TLS Version #46308
Comments
This function returns an string representation (`TLSv1.0`, `TLSv1.1`, ...) given a TLS version number. Fixes golang#46308
This function returns an string representation (`TLSv1.0`, `TLSv1.1`, ...) given a TLS version number. Fixes golang#46308
Change https://golang.org/cl/321733 mentions this issue: |
CC @FiloSottile, @katiehockman, @rolandshoemaker via owners. |
cc @ianlancetaylor re likely proposal |
This proposal has been added to the active column of the proposals project |
Generally seems reasonable. |
Based on the discussion above, this proposal seems like a likely accept. |
No change in consensus, so accepted. 🎉 |
Was a |
Is there a way to convert the constants to a named type within the Go 1 Compatibility Promise? |
If there could be a named type someone, a |
CC @golang/security Do we want to try to get this into 1.19? Otherwise, what should the milestone be? @FiloSottile Converting an untyped constant to a named type technically violates the Go 1 compatibility guarantee. |
Seems unlikely to happen for 1.19, moving to 1.20 seems fine. |
I am writing my own stop-gap for this functionality but would like to swap that impl for this proposal once available. Is there an inclination/decision towards the expected string value/pattern for these names? For instance, will it match the |
When I did the PR I used the names that are most common everywhere for representing each version instead of using the constant name. |
This comment was marked as duplicate.
This comment was marked as duplicate.
Change https://go.dev/cl/497377 mentions this issue: |
I propose to add a
func VersionName(version uint16) string
method that returns a string representation (TLSv1.0
,TLSv1.1
, ...) given a version id.Currently
crypto/tls
provides similar functionality for the cipher suites but not for the version. I've seen myself and others implementing this in our codes to print it in logs and other places, but this is far from ideal as, for example, if a new protocol is added in the future, that code would be outdated.I couldn't find any related issue or ongoing work so I'll be opening a PR.
The text was updated successfully, but these errors were encountered: