mirror of https://github.com/tikv/client-go.git
config: remove unused utility (#269)
Signed-off-by: disksing <i@disksing.com>
This commit is contained in:
parent
288c649636
commit
b7d1044eb5
|
|
@ -36,10 +36,8 @@ package config
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
|
||||
"github.com/pingcap/errors"
|
||||
|
|
@ -205,38 +203,3 @@ func ParsePath(path string) (etcdAddrs []string, disableGC bool, err error) {
|
|||
etcdAddrs = strings.Split(u.Host, ",")
|
||||
return
|
||||
}
|
||||
|
||||
var (
|
||||
internalClientInit sync.Once
|
||||
internalHTTPClient *http.Client
|
||||
internalHTTPSchema string
|
||||
)
|
||||
|
||||
// InternalHTTPClient is used by TiDB-Server to request other components.
|
||||
func InternalHTTPClient() *http.Client {
|
||||
internalClientInit.Do(initInternalClient)
|
||||
return internalHTTPClient
|
||||
}
|
||||
|
||||
// InternalHTTPSchema specifies use http or https to request other components.
|
||||
func InternalHTTPSchema() string {
|
||||
internalClientInit.Do(initInternalClient)
|
||||
return internalHTTPSchema
|
||||
}
|
||||
|
||||
func initInternalClient() {
|
||||
clusterSecurity := GetGlobalConfig().Security
|
||||
tlsCfg, err := clusterSecurity.ToTLSConfig()
|
||||
if err != nil {
|
||||
logutil.BgLogger().Fatal("could not load cluster ssl", zap.Error(err))
|
||||
}
|
||||
if tlsCfg == nil {
|
||||
internalHTTPSchema = "http"
|
||||
internalHTTPClient = http.DefaultClient
|
||||
return
|
||||
}
|
||||
internalHTTPSchema = "https"
|
||||
internalHTTPClient = &http.Client{
|
||||
Transport: &http.Transport{TLSClientConfig: tlsCfg},
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue