Skip to content

Commit

Permalink
fix(redis): supports pass the tls server name for redis tls connection (
Browse files Browse the repository at this point in the history
  • Loading branch information
yetone authored Sep 25, 2024
1 parent bd3553f commit ad6cf90
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/meta/redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ func newRedisMeta(driver, addr string, conf *Config) (Meta, error) {
certFile := query.pop("tls-cert-file")
keyFile := query.pop("tls-key-file")
caCertFile := query.pop("tls-ca-cert-file")
tlsServerName := query.pop("tls-server-name")
u.RawQuery = values.Encode()

hosts := u.Host
Expand All @@ -125,7 +126,7 @@ func newRedisMeta(driver, addr string, conf *Config) (Meta, error) {
return nil, fmt.Errorf("redis parse %s: %s", uri, err)
}
if opt.TLSConfig != nil {
opt.TLSConfig.ServerName = "" // use the host of each connection as ServerName
opt.TLSConfig.ServerName = tlsServerName // use the host of each connection as ServerName
opt.TLSConfig.InsecureSkipVerify = skipVerify != ""
if certFile != "" {
cert, err := tls.LoadX509KeyPair(certFile, keyFile)
Expand Down

0 comments on commit ad6cf90

Please sign in to comment.