Преглед на файлове

Merge pull request #5075 from xiang90/p

proxy: move http related thing to httpproxy
Xiang Li преди 9 години
родител
ревизия
ac95cc32ef

+ 4 - 4
etcdmain/etcd.go

@@ -39,7 +39,7 @@ import (
 	runtimeutil "github.com/coreos/etcd/pkg/runtime"
 	"github.com/coreos/etcd/pkg/transport"
 	"github.com/coreos/etcd/pkg/types"
-	"github.com/coreos/etcd/proxy"
+	"github.com/coreos/etcd/proxy/httpproxy"
 	"github.com/coreos/etcd/rafthttp"
 	"github.com/coreos/etcd/version"
 	"github.com/coreos/go-systemd/daemon"
@@ -391,7 +391,7 @@ func startProxy(cfg *config) error {
 	if err != nil {
 		return err
 	}
-	pt.MaxIdleConnsPerHost = proxy.DefaultMaxIdleConnsPerHost
+	pt.MaxIdleConnsPerHost = httpproxy.DefaultMaxIdleConnsPerHost
 
 	tr, err := transport.NewTimeoutTransport(cfg.peerTLSInfo, time.Duration(cfg.proxyDialTimeoutMs)*time.Millisecond, time.Duration(cfg.proxyReadTimeoutMs)*time.Millisecond, time.Duration(cfg.proxyWriteTimeoutMs)*time.Millisecond)
 	if err != nil {
@@ -484,14 +484,14 @@ func startProxy(cfg *config) error {
 
 		return clientURLs
 	}
-	ph := proxy.NewHandler(pt, uf, time.Duration(cfg.proxyFailureWaitMs)*time.Millisecond, time.Duration(cfg.proxyRefreshIntervalMs)*time.Millisecond)
+	ph := httpproxy.NewHandler(pt, uf, time.Duration(cfg.proxyFailureWaitMs)*time.Millisecond, time.Duration(cfg.proxyRefreshIntervalMs)*time.Millisecond)
 	ph = &cors.CORSHandler{
 		Handler: ph,
 		Info:    cfg.corsInfo,
 	}
 
 	if cfg.isReadonlyProxy() {
-		ph = proxy.NewReadonlyHandler(ph)
+		ph = httpproxy.NewReadonlyHandler(ph)
 	}
 	// Start a proxy server goroutine for each listen address
 	for _, u := range cfg.lcurls {

+ 1 - 1
proxy/director.go → proxy/httpproxy/director.go

@@ -12,7 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package proxy
+package httpproxy
 
 import (
 	"log"

+ 1 - 1
proxy/director_test.go → proxy/httpproxy/director_test.go

@@ -12,7 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package proxy
+package httpproxy
 
 import (
 	"net/url"

+ 3 - 3
proxy/doc.go → proxy/httpproxy/doc.go

@@ -12,7 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-// Package proxy implements etcd proxy node. The etcd proxy acts as a reverse
-// proxy forwarding client requests to active etcd cluster members, and does
+// Package httpproxy implements etcd httpproxy. The etcd proxy acts as a reverse
+// http proxy forwarding client requests to active etcd cluster members, and does
 // not participate in consensus.
-package proxy
+package httpproxy

+ 1 - 1
proxy/metrics.go → proxy/httpproxy/metrics.go

@@ -12,7 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package proxy
+package httpproxy
 
 import (
 	"net/http"

+ 1 - 1
proxy/proxy.go → proxy/httpproxy/proxy.go

@@ -12,7 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package proxy
+package httpproxy
 
 import (
 	"encoding/json"

+ 1 - 1
proxy/proxy_test.go → proxy/httpproxy/proxy_test.go

@@ -12,7 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package proxy
+package httpproxy
 
 import (
 	"io/ioutil"

+ 1 - 1
proxy/reverse.go → proxy/httpproxy/reverse.go

@@ -12,7 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package proxy
+package httpproxy
 
 import (
 	"bytes"

+ 1 - 1
proxy/reverse_test.go → proxy/httpproxy/reverse_test.go

@@ -12,7 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package proxy
+package httpproxy
 
 import (
 	"bytes"

+ 1 - 1
test

@@ -28,7 +28,7 @@ ln -s ${PWD}/cmd/vendor $GOPATH/src
 
 # Hack: gofmt ./ will recursively check the .git directory. So use *.go for gofmt.
 PKGS=`ls pkg/*/*go  | cut -f1,2 -d/ | sort | uniq`
-TESTABLE_AND_FORMATTABLE="client clientv3 discovery error etcdctl/ctlv2 etcdctl/ctlv3 etcdmain etcdserver etcdserver/auth etcdserver/api/v2http etcdserver/api/v2http/httptypes $PKGS proxy raft snap storage storage/backend store version wal"
+TESTABLE_AND_FORMATTABLE="client clientv3 discovery error etcdctl/ctlv2 etcdctl/ctlv3 etcdmain etcdserver etcdserver/auth etcdserver/api/v2http etcdserver/api/v2http/httptypes $PKGS proxy/httpproxy raft snap storage storage/backend store version wal"
 # TODO: add it to race testing when the issue is resolved
 # https://github.com/golang/go/issues/9946
 NO_RACE_TESTABLE="rafthttp"