mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
discovery: use pkg/transport to create http transport
This commit is contained in:
parent
54d56e2531
commit
bbb84ff709
@ -20,7 +20,6 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"math"
|
"math"
|
||||||
"net"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"path"
|
"path"
|
||||||
@ -30,6 +29,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/coreos/etcd/client"
|
"github.com/coreos/etcd/client"
|
||||||
|
"github.com/coreos/etcd/pkg/transport"
|
||||||
"github.com/coreos/etcd/pkg/types"
|
"github.com/coreos/etcd/pkg/types"
|
||||||
"github.com/coreos/pkg/capnslog"
|
"github.com/coreos/pkg/capnslog"
|
||||||
"github.com/jonboulle/clockwork"
|
"github.com/jonboulle/clockwork"
|
||||||
@ -124,16 +124,15 @@ func newDiscovery(durl, dproxyurl string, id types.ID) (*discovery, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: add ResponseHeaderTimeout back when watch on discovery service writes header early
|
||||||
|
tr, err := transport.NewTransport(transport.TLSInfo{}, 30*time.Second)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
tr.Proxy = pf
|
||||||
cfg := client.Config{
|
cfg := client.Config{
|
||||||
Transport: &http.Transport{
|
Transport: tr,
|
||||||
Proxy: pf,
|
|
||||||
Dial: (&net.Dialer{
|
|
||||||
Timeout: 30 * time.Second,
|
|
||||||
KeepAlive: 30 * time.Second,
|
|
||||||
}).Dial,
|
|
||||||
TLSHandshakeTimeout: 10 * time.Second,
|
|
||||||
// TODO: add ResponseHeaderTimeout back when watch on discovery service writes header early
|
|
||||||
},
|
|
||||||
Endpoints: []string{u.String()},
|
Endpoints: []string{u.String()},
|
||||||
}
|
}
|
||||||
c, err := client.New(cfg)
|
c, err := client.New(cfg)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user