mirror of https://github.com/etcd-io/dbtester.git
control: use different transport for client
This commit is contained in:
parent
cb08df90d0
commit
acf739c8f5
|
|
@ -21,6 +21,7 @@ import (
|
|||
"io"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
"strconv"
|
||||
|
|
@ -104,9 +105,18 @@ func mustCreateClientsEtcdv2(endpoints []string, total int) []clientv2.KeysAPI {
|
|||
if !strings.HasPrefix(endpoint, "http://") {
|
||||
endpoint = "http://" + endpoint
|
||||
}
|
||||
|
||||
tr := &http.Transport{
|
||||
Proxy: http.ProxyFromEnvironment,
|
||||
Dial: (&net.Dialer{
|
||||
Timeout: 30 * time.Second,
|
||||
KeepAlive: 30 * time.Second,
|
||||
}).Dial,
|
||||
TLSHandshakeTimeout: 10 * time.Second,
|
||||
}
|
||||
cfg := clientv2.Config{
|
||||
Endpoints: []string{endpoint},
|
||||
Transport: clientv2.DefaultTransport,
|
||||
Transport: tr,
|
||||
HeaderTimeoutPerRequest: time.Second,
|
||||
}
|
||||
c, err := clientv2.New(cfg)
|
||||
|
|
|
|||
Loading…
Reference in New Issue