From 66d2ae7a3949d19ae7917b154a5fbcf23ba2c10a Mon Sep 17 00:00:00 2001 From: Xiang Li Date: Wed, 13 Apr 2016 21:09:08 -0700 Subject: [PATCH] proxy: move http related thing to httpproxy --- etcdmain/etcd.go | 8 ++++---- proxy/{ => httpproxy}/director.go | 2 +- proxy/{ => httpproxy}/director_test.go | 2 +- proxy/{ => httpproxy}/doc.go | 6 +++--- proxy/{ => httpproxy}/metrics.go | 2 +- proxy/{ => httpproxy}/proxy.go | 2 +- proxy/{ => httpproxy}/proxy_test.go | 2 +- proxy/{ => httpproxy}/reverse.go | 2 +- proxy/{ => httpproxy}/reverse_test.go | 2 +- test | 2 +- 10 files changed, 15 insertions(+), 15 deletions(-) rename proxy/{ => httpproxy}/director.go (99%) rename proxy/{ => httpproxy}/director_test.go (99%) rename proxy/{ => httpproxy}/doc.go (77%) rename proxy/{ => httpproxy}/metrics.go (99%) rename proxy/{ => httpproxy}/proxy.go (99%) rename proxy/{ => httpproxy}/proxy_test.go (99%) rename proxy/{ => httpproxy}/reverse.go (99%) rename proxy/{ => httpproxy}/reverse_test.go (99%) diff --git a/etcdmain/etcd.go b/etcdmain/etcd.go index 0eb83afd6..e8d1516b5 100644 --- a/etcdmain/etcd.go +++ b/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 { diff --git a/proxy/director.go b/proxy/httpproxy/director.go similarity index 99% rename from proxy/director.go rename to proxy/httpproxy/director.go index ece8242c1..0eb4b6136 100644 --- a/proxy/director.go +++ b/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" diff --git a/proxy/director_test.go b/proxy/httpproxy/director_test.go similarity index 99% rename from proxy/director_test.go rename to proxy/httpproxy/director_test.go index ac1c82a09..24bb433b5 100644 --- a/proxy/director_test.go +++ b/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" diff --git a/proxy/doc.go b/proxy/httpproxy/doc.go similarity index 77% rename from proxy/doc.go rename to proxy/httpproxy/doc.go index 181a3e0fa..561a22e45 100644 --- a/proxy/doc.go +++ b/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 diff --git a/proxy/metrics.go b/proxy/httpproxy/metrics.go similarity index 99% rename from proxy/metrics.go rename to proxy/httpproxy/metrics.go index 3a6fefb16..5cb80c78e 100644 --- a/proxy/metrics.go +++ b/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" diff --git a/proxy/proxy.go b/proxy/httpproxy/proxy.go similarity index 99% rename from proxy/proxy.go rename to proxy/httpproxy/proxy.go index bf47f0999..e70d47487 100644 --- a/proxy/proxy.go +++ b/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" diff --git a/proxy/proxy_test.go b/proxy/httpproxy/proxy_test.go similarity index 99% rename from proxy/proxy_test.go rename to proxy/httpproxy/proxy_test.go index 735068ac4..21a9195f5 100644 --- a/proxy/proxy_test.go +++ b/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" diff --git a/proxy/reverse.go b/proxy/httpproxy/reverse.go similarity index 99% rename from proxy/reverse.go rename to proxy/httpproxy/reverse.go index 4d754e38b..e683f0ca2 100644 --- a/proxy/reverse.go +++ b/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" diff --git a/proxy/reverse_test.go b/proxy/httpproxy/reverse_test.go similarity index 99% rename from proxy/reverse_test.go rename to proxy/httpproxy/reverse_test.go index 01f5cfcd4..873943143 100644 --- a/proxy/reverse_test.go +++ b/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" diff --git a/test b/test index 7c1f9c547..8f0c2da90 100755 --- a/test +++ b/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"