mediocregopher / radix.v2

Redis client for Go
http://godoc.org/github.com/mediocregopher/radix.v2
MIT License
433 stars 92 forks source link

Redis SSL connections #78

Closed tkrajina closed 6 years ago

tkrajina commented 6 years ago

This pull request creates a new method DialTLSTimeout() which uses

conn, err := tls.Dial(network, addr, &tlsConfig)

...instead of...

    conn, err := net.DialTimeout(network, addr, timeout)

It allows to use a SSL socket to a Redis server.

pdeva commented 6 years ago

ssl support is very much needed since hosted redis instances on cloud services like azure use ssl by default

tkrajina commented 6 years ago

Thanks, @mediocregopher I just updated the PR. Will add an TLS example next. Just wanted to know something, if I use NewClient() by default the client has no WriteTimeout and ReadTimeout set. Now, I know that I should set it explicitly, but a typical caller of NewClient() will possibly forget it. I don't know all the internals, but how big a problem that is?

mediocregopher commented 6 years ago

a typical caller of NewClient() will possibly forget it. I don't know all the internals, but how big a problem that is?

This is fine, the other internals handle that case correctly. In fact the normal Dial function leaves than unset also.