lib/netutil/tls.go: consistently use tlsMinVersion name across source code

This should simplify further code maintenance and refactoring

This is a follow-up after 6ab1cede62
This commit is contained in:
Aliaksandr Valialkin 2022-09-26 17:57:59 +03:00
parent 6ab1cede62
commit 6411bbcce7
No known key found for this signature in database
GPG Key ID: A72BEC6CD3D0DED1

View File

@ -10,7 +10,7 @@ import (
) )
// GetServerTLSConfig returns TLS config for the server. // GetServerTLSConfig returns TLS config for the server.
func GetServerTLSConfig(tlsCertFile, tlsKeyFile, minTLSVersion string, tlsCipherSuites []string) (*tls.Config, error) { func GetServerTLSConfig(tlsCertFile, tlsKeyFile, tlsMinVersion string, tlsCipherSuites []string) (*tls.Config, error) {
var certLock sync.Mutex var certLock sync.Mutex
var certDeadline uint64 var certDeadline uint64
var cert *tls.Certificate var cert *tls.Certificate
@ -22,9 +22,9 @@ func GetServerTLSConfig(tlsCertFile, tlsKeyFile, minTLSVersion string, tlsCipher
if err != nil { if err != nil {
return nil, fmt.Errorf("cannot use TLS cipher suites from tlsCipherSuites=%q: %w", tlsCipherSuites, err) return nil, fmt.Errorf("cannot use TLS cipher suites from tlsCipherSuites=%q: %w", tlsCipherSuites, err)
} }
minVersion, err := ParseTLSVersion(minTLSVersion) minVersion, err := ParseTLSVersion(tlsMinVersion)
if err != nil { if err != nil {
return nil, fmt.Errorf("cannnot use TLS min version from minTLSVersion=%q. Supported TLS versions (TLS10, TLS11, TLS12, TLS13): %w", minTLSVersion, err) return nil, fmt.Errorf("cannnot use TLS min version from tlsMinVersion=%q. Supported TLS versions (TLS10, TLS11, TLS12, TLS13): %w", tlsMinVersion, err)
} }
cert = &c cert = &c
cfg := &tls.Config{ cfg := &tls.Config{