|
@@ -7,9 +7,7 @@ import (
|
|
|
"flag"
|
|
"flag"
|
|
|
"github.com/coreos/etcd/store"
|
|
"github.com/coreos/etcd/store"
|
|
|
"github.com/coreos/etcd/web"
|
|
"github.com/coreos/etcd/web"
|
|
|
-
|
|
|
|
|
"io/ioutil"
|
|
"io/ioutil"
|
|
|
- "net"
|
|
|
|
|
"net/http"
|
|
"net/http"
|
|
|
"net/url"
|
|
"net/url"
|
|
|
"os"
|
|
"os"
|
|
@@ -225,31 +223,6 @@ func main() {
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-// Create transporter using by raft server
|
|
|
|
|
-// Create http or https transporter based on
|
|
|
|
|
-// whether the user give the server cert and key
|
|
|
|
|
-func newTransporter(scheme string, tlsConf tls.Config) transporter {
|
|
|
|
|
- t := transporter{}
|
|
|
|
|
-
|
|
|
|
|
- tr := &http.Transport{
|
|
|
|
|
- Dial: dialTimeout,
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if scheme == "https" {
|
|
|
|
|
- tr.TLSClientConfig = &tlsConf
|
|
|
|
|
- tr.DisableCompression = true
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- t.client = &http.Client{Transport: tr}
|
|
|
|
|
-
|
|
|
|
|
- return t
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-// Dial with timeout
|
|
|
|
|
-func dialTimeout(network, addr string) (net.Conn, error) {
|
|
|
|
|
- return net.DialTimeout(network, addr, HTTPTimeout)
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
// Start to listen and response client command
|
|
// Start to listen and response client command
|
|
|
func startEtcdTransport(info Info, scheme string, tlsConf tls.Config) {
|
|
func startEtcdTransport(info Info, scheme string, tlsConf tls.Config) {
|
|
|
u, err := url.Parse(info.EtcdURL)
|
|
u, err := url.Parse(info.EtcdURL)
|