Skip to content

Commit

Permalink
refactor: simplify and refactor TLS function implementation
Browse files Browse the repository at this point in the history
- Simplify the `WithTLS` function documentation
- Remove setting the `ServerName` in the `WithTLS` function

Signed-off-by: appleboy <appleboy.tw@gmail.com>
  • Loading branch information
appleboy committed Jan 5, 2025
1 parent 61e5e01 commit 5bd7ef5
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions options.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,13 @@ func WithSentinel(enable bool) Option {
}
}

// WithTLS is an option function that configures the Redis connection to use TLS.
// It sets the ServerName to the address of the Redis server and enforces a minimum
// TLS version of 1.2.
// WithTLS returns an Option that configures the use of TLS for the connection.
// It sets the minimum TLS version to TLS 1.2.
func WithTLS() Option {
return func(w *options) {
w.tls = &tls.Config{
MinVersion: tls.VersionTLS12,
}
if w.addr != "" {
w.tls.ServerName = w.addr
}
}
}

Expand Down

0 comments on commit 5bd7ef5

Please sign in to comment.