1
0
mirror of https://github.com/redis/go-redis.git synced 2025-07-31 05:04:23 +03:00

Rename DialTCP NewTCPClient.

This commit is contained in:
Vladimir Mihailenco
2013-09-29 11:15:18 +03:00
parent f54394beb6
commit 63282071de
3 changed files with 14 additions and 26 deletions

View File

@ -1,7 +1,6 @@
package redis
import (
"crypto/tls"
"log"
"net"
"os"
@ -187,25 +186,14 @@ func newClient(opt *Options, dial func() (net.Conn, error)) *Client {
}
}
func DialTCP(opt *Options) *Client {
func NewTCPClient(opt *Options) *Client {
dial := func() (net.Conn, error) {
return net.DialTimeout("tcp", opt.Addr, opt.getDialTimeout())
}
return newClient(opt, dial)
}
func DialTLS(opt *Options, tlsConfig *tls.Config) *Client {
dial := func() (net.Conn, error) {
conn, err := net.DialTimeout("tcp", opt.Addr, opt.getDialTimeout())
if err != nil {
return nil, err
}
return tls.Client(conn, tlsConfig), nil
}
return newClient(opt, dial)
}
func DialUnix(opt *Options) *Client {
func NewUnixClient(opt *Options) *Client {
dial := func() (net.Conn, error) {
return net.DialTimeout("unix", opt.Addr, opt.getDialTimeout())
}