rename MinVersion to TLSMinVersion

This commit is contained in:
Ulric Qin 2022-04-22 22:25:02 +08:00
parent 06672d5ff9
commit 614ed283c0
3 changed files with 7 additions and 7 deletions

View File

@ -119,7 +119,7 @@ Address = "127.0.0.1:6379"
# Password = "" # Password = ""
# DB = 0 # DB = 0
# UseTLS = false # UseTLS = false
# MinVersion = "1.2" # TLSMinVersion = "1.2"
[Gorm] [Gorm]
# enable debug mode or not # enable debug mode or not

View File

@ -142,7 +142,7 @@ Address = "127.0.0.1:6379"
# Password = "" # Password = ""
# DB = 0 # DB = 0
# UseTLS = false # UseTLS = false
# MinVersion = "1.2" # TLSMinVersion = "1.2"
[Gorm] [Gorm]
# enable debug mode or not # enable debug mode or not

View File

@ -18,7 +18,7 @@ type ClientConfig struct {
TLSKeyPwd string TLSKeyPwd string
InsecureSkipVerify bool InsecureSkipVerify bool
ServerName string ServerName string
MinVersion string TLSMinVersion string
} }
// ServerConfig represents the standard server TLS config. // ServerConfig represents the standard server TLS config.
@ -71,13 +71,13 @@ func (c *ClientConfig) TLSConfig() (*tls.Config, error) {
tlsConfig.ServerName = c.ServerName tlsConfig.ServerName = c.ServerName
} }
if c.MinVersion == "1.0" { if c.TLSMinVersion == "1.0" {
tlsConfig.MinVersion = tls.VersionTLS10 tlsConfig.MinVersion = tls.VersionTLS10
} else if c.MinVersion == "1.1" { } else if c.TLSMinVersion == "1.1" {
tlsConfig.MinVersion = tls.VersionTLS11 tlsConfig.MinVersion = tls.VersionTLS11
} else if c.MinVersion == "1.2" { } else if c.TLSMinVersion == "1.2" {
tlsConfig.MinVersion = tls.VersionTLS12 tlsConfig.MinVersion = tls.VersionTLS12
} else if c.MinVersion == "1.3" { } else if c.TLSMinVersion == "1.3" {
tlsConfig.MinVersion = tls.VersionTLS13 tlsConfig.MinVersion = tls.VersionTLS13
} }