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:
16
v2/redis.go
16
v2/redis.go
@ -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())
|
||||
}
|
||||
|
Reference in New Issue
Block a user