Skip to content

Commit

Permalink
tlsconfig: move allTLSVersions var
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
  • Loading branch information
thaJeztah committed Nov 10, 2023
1 parent dca283b commit 2cf423f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
10 changes: 10 additions & 0 deletions tlsconfig/config.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Package tlsconfig provides primitives to retrieve secure-enough TLS configurations for both clients and servers.
//
// As a reminder from https://golang.org/pkg/crypto/tls/#Config:
//
// A Config structure is used to configure a TLS client or server. After one has been passed to a TLS function it must not be modified.
// A Config may be reused; the tls package will also not modify it.
package tlsconfig
Expand Down Expand Up @@ -113,6 +114,15 @@ func certPool(caFile string, exclusivePool bool) (*x509.CertPool, error) {
return certPool, nil
}

// allTLSVersions lists all the TLS versions and is used by the code that validates
// a uint16 value as a TLS version.
var allTLSVersions = map[uint16]struct{}{
tls.VersionTLS10: {},
tls.VersionTLS11: {},
tls.VersionTLS12: {},
tls.VersionTLS13: {},
}

// isValidMinVersion checks that the input value is a valid tls minimum version
func isValidMinVersion(version uint16) bool {
_, ok := allTLSVersions[version]
Expand Down
14 changes: 0 additions & 14 deletions tlsconfig/versions.go

This file was deleted.

0 comments on commit 2cf423f

Please sign in to comment.