From b06ddc9187378368ce9faf9dc236c4a9e915dcb3 Mon Sep 17 00:00:00 2001 From: Paul Banks Date: Thu, 6 Sep 2018 11:50:38 +0100 Subject: [PATCH] Rename proxy package (re-run of #4550) (#4638) * Rename agent/proxy package to reflect that it is limited to managed proxy processes Rationale: we have several other components of the agent that relate to Connect proxies for example the ProxyConfigManager component needed for Envoy work. Those things are pretty separate from the focus of this package so far which is only concerned with managing external proxy processes so it's nota good fit to put code for that in here, yet there is a naming clash if we have other packages related to proxy functionality that are not in the `agent/proxy` package. Happy to bikeshed the name. I started by calling it `managedproxy` but `managedproxy.Manager` is especially unpleasant. `proxyprocess` seems good in that it's more specific about purpose but less clearly connected with the concept of "managed proxies". The names in use are cleaner though e.g. `proxyprocess.Manager`. This rename was completed automatically using golang.org/x/tools/cmd/gomvpkg. Depends on #4541 * Fix missed windows tagged files --- agent/agent.go | 6 +++--- agent/{proxy => proxyprocess}/daemon.go | 2 +- agent/{proxy => proxyprocess}/daemon_test.go | 2 +- agent/{proxy => proxyprocess}/exitstatus_other.go | 2 +- agent/{proxy => proxyprocess}/exitstatus_syscall.go | 2 +- agent/{proxy => proxyprocess}/manager.go | 2 +- agent/{proxy => proxyprocess}/manager_test.go | 2 +- agent/{proxy => proxyprocess}/noop.go | 2 +- agent/{proxy => proxyprocess}/noop_test.go | 2 +- agent/{proxy => proxyprocess}/process.go | 2 +- agent/{proxy => proxyprocess}/process_unix.go | 2 +- agent/{proxy => proxyprocess}/process_windows.go | 2 +- agent/{proxy => proxyprocess}/proxy.go | 2 +- agent/{proxy => proxyprocess}/proxy_test.go | 2 +- agent/{proxy => proxyprocess}/root.go | 2 +- agent/{proxy => proxyprocess}/snapshot.go | 2 +- agent/{proxy => proxyprocess}/test.go | 2 +- command/connect/proxy/proxy.go | 2 +- 18 files changed, 20 insertions(+), 20 deletions(-) rename agent/{proxy => proxyprocess}/daemon.go (99%) rename agent/{proxy => proxyprocess}/daemon_test.go (99%) rename agent/{proxy => proxyprocess}/exitstatus_other.go (90%) rename agent/{proxy => proxyprocess}/exitstatus_syscall.go (94%) rename agent/{proxy => proxyprocess}/manager.go (99%) rename agent/{proxy => proxyprocess}/manager_test.go (99%) rename agent/{proxy => proxyprocess}/noop.go (96%) rename agent/{proxy => proxyprocess}/noop_test.go (80%) rename agent/{proxy => proxyprocess}/process.go (95%) rename agent/{proxy => proxyprocess}/process_unix.go (98%) rename agent/{proxy => proxyprocess}/process_windows.go (94%) rename agent/{proxy => proxyprocess}/proxy.go (99%) rename agent/{proxy => proxyprocess}/proxy_test.go (99%) rename agent/{proxy => proxyprocess}/root.go (95%) rename agent/{proxy => proxyprocess}/snapshot.go (99%) rename agent/{proxy => proxyprocess}/test.go (95%) diff --git a/agent/agent.go b/agent/agent.go index ab5c605f6ddb..cec9612993ad 100644 --- a/agent/agent.go +++ b/agent/agent.go @@ -27,7 +27,7 @@ import ( "github.com/hashicorp/consul/agent/config" "github.com/hashicorp/consul/agent/consul" "github.com/hashicorp/consul/agent/local" - "github.com/hashicorp/consul/agent/proxy" + "github.com/hashicorp/consul/agent/proxyprocess" "github.com/hashicorp/consul/agent/structs" "github.com/hashicorp/consul/agent/systemd" "github.com/hashicorp/consul/agent/token" @@ -211,7 +211,7 @@ type Agent struct { tokens *token.Store // proxyManager is the proxy process manager for managed Connect proxies. - proxyManager *proxy.Manager + proxyManager *proxyprocess.Manager // proxyLock protects proxy information in the local state from concurrent modification proxyLock sync.Mutex @@ -282,7 +282,7 @@ func (a *Agent) setupProxyManager() error { if err != nil { return fmt.Errorf("[INFO] agent: Connect managed proxies are disabled due to providing an invalid HTTP configuration") } - a.proxyManager = proxy.NewManager() + a.proxyManager = proxyprocess.NewManager() a.proxyManager.AllowRoot = a.config.ConnectProxyAllowManagedRoot a.proxyManager.State = a.State a.proxyManager.Logger = a.logger diff --git a/agent/proxy/daemon.go b/agent/proxyprocess/daemon.go similarity index 99% rename from agent/proxy/daemon.go rename to agent/proxyprocess/daemon.go index 8b37ffb197af..8887bbaeb0a8 100644 --- a/agent/proxy/daemon.go +++ b/agent/proxyprocess/daemon.go @@ -1,4 +1,4 @@ -package proxy +package proxyprocess import ( "fmt" diff --git a/agent/proxy/daemon_test.go b/agent/proxyprocess/daemon_test.go similarity index 99% rename from agent/proxy/daemon_test.go rename to agent/proxyprocess/daemon_test.go index 80fb9b533ef0..0fbfb2f1271d 100644 --- a/agent/proxy/daemon_test.go +++ b/agent/proxyprocess/daemon_test.go @@ -1,4 +1,4 @@ -package proxy +package proxyprocess import ( "io/ioutil" diff --git a/agent/proxy/exitstatus_other.go b/agent/proxyprocess/exitstatus_other.go similarity index 90% rename from agent/proxy/exitstatus_other.go rename to agent/proxyprocess/exitstatus_other.go index 84dd88867d55..b5e4422df47a 100644 --- a/agent/proxy/exitstatus_other.go +++ b/agent/proxyprocess/exitstatus_other.go @@ -1,6 +1,6 @@ // +build !darwin,!linux,!windows -package proxy +package proxyprocess import "os" diff --git a/agent/proxy/exitstatus_syscall.go b/agent/proxyprocess/exitstatus_syscall.go similarity index 94% rename from agent/proxy/exitstatus_syscall.go rename to agent/proxyprocess/exitstatus_syscall.go index 1caeda4bf163..65492e3cc318 100644 --- a/agent/proxy/exitstatus_syscall.go +++ b/agent/proxyprocess/exitstatus_syscall.go @@ -1,6 +1,6 @@ // +build darwin linux windows -package proxy +package proxyprocess import ( "os" diff --git a/agent/proxy/manager.go b/agent/proxyprocess/manager.go similarity index 99% rename from agent/proxy/manager.go rename to agent/proxyprocess/manager.go index d0b59fb0b589..a4470b7f264a 100644 --- a/agent/proxy/manager.go +++ b/agent/proxyprocess/manager.go @@ -1,4 +1,4 @@ -package proxy +package proxyprocess import ( "fmt" diff --git a/agent/proxy/manager_test.go b/agent/proxyprocess/manager_test.go similarity index 99% rename from agent/proxy/manager_test.go rename to agent/proxyprocess/manager_test.go index c1d2f66a0c5b..2737b85fb7c2 100644 --- a/agent/proxy/manager_test.go +++ b/agent/proxyprocess/manager_test.go @@ -1,4 +1,4 @@ -package proxy +package proxyprocess import ( "io/ioutil" diff --git a/agent/proxy/noop.go b/agent/proxyprocess/noop.go similarity index 96% rename from agent/proxy/noop.go rename to agent/proxyprocess/noop.go index 62599f8956d7..219eec719edc 100644 --- a/agent/proxy/noop.go +++ b/agent/proxyprocess/noop.go @@ -1,4 +1,4 @@ -package proxy +package proxyprocess // Noop implements Proxy and does nothing. type Noop struct{} diff --git a/agent/proxy/noop_test.go b/agent/proxyprocess/noop_test.go similarity index 80% rename from agent/proxy/noop_test.go rename to agent/proxyprocess/noop_test.go index 77513ad29f2a..5833b6a606e6 100644 --- a/agent/proxy/noop_test.go +++ b/agent/proxyprocess/noop_test.go @@ -1,4 +1,4 @@ -package proxy +package proxyprocess import ( "testing" diff --git a/agent/proxy/process.go b/agent/proxyprocess/process.go similarity index 95% rename from agent/proxy/process.go rename to agent/proxyprocess/process.go index d299941fde07..f9bb10bbe964 100644 --- a/agent/proxy/process.go +++ b/agent/proxyprocess/process.go @@ -1,4 +1,4 @@ -package proxy +package proxyprocess import ( "strings" diff --git a/agent/proxy/process_unix.go b/agent/proxyprocess/process_unix.go similarity index 98% rename from agent/proxy/process_unix.go rename to agent/proxyprocess/process_unix.go index 665b0d09e5d1..08618f0400df 100644 --- a/agent/proxy/process_unix.go +++ b/agent/proxyprocess/process_unix.go @@ -1,6 +1,6 @@ // +build !windows -package proxy +package proxyprocess import ( "fmt" diff --git a/agent/proxy/process_windows.go b/agent/proxyprocess/process_windows.go similarity index 94% rename from agent/proxy/process_windows.go rename to agent/proxyprocess/process_windows.go index 99e2248d50cc..8f7bca23f267 100644 --- a/agent/proxy/process_windows.go +++ b/agent/proxyprocess/process_windows.go @@ -1,6 +1,6 @@ // +build windows -package proxy +package proxyprocess import ( "os" diff --git a/agent/proxy/proxy.go b/agent/proxyprocess/proxy.go similarity index 99% rename from agent/proxy/proxy.go rename to agent/proxyprocess/proxy.go index 91f44dc998a3..e2ef7fe47a39 100644 --- a/agent/proxy/proxy.go +++ b/agent/proxyprocess/proxy.go @@ -5,7 +5,7 @@ // // This package does not contain the built-in proxy for Connect. The source // for that is available in the "connect/proxy" package. -package proxy +package proxyprocess import ( "github.com/hashicorp/consul/agent/structs" diff --git a/agent/proxy/proxy_test.go b/agent/proxyprocess/proxy_test.go similarity index 99% rename from agent/proxy/proxy_test.go rename to agent/proxyprocess/proxy_test.go index 0ac0446a8ffd..9db343680b97 100644 --- a/agent/proxy/proxy_test.go +++ b/agent/proxyprocess/proxy_test.go @@ -1,4 +1,4 @@ -package proxy +package proxyprocess import ( "fmt" diff --git a/agent/proxy/root.go b/agent/proxyprocess/root.go similarity index 95% rename from agent/proxy/root.go rename to agent/proxyprocess/root.go index 3be5904ae36b..3e987131df40 100644 --- a/agent/proxy/root.go +++ b/agent/proxyprocess/root.go @@ -1,4 +1,4 @@ -package proxy +package proxyprocess import ( "os" diff --git a/agent/proxy/snapshot.go b/agent/proxyprocess/snapshot.go similarity index 99% rename from agent/proxy/snapshot.go rename to agent/proxyprocess/snapshot.go index dbe03fd83dd2..05f07cc44753 100644 --- a/agent/proxy/snapshot.go +++ b/agent/proxyprocess/snapshot.go @@ -1,4 +1,4 @@ -package proxy +package proxyprocess import ( "encoding/json" diff --git a/agent/proxy/test.go b/agent/proxyprocess/test.go similarity index 95% rename from agent/proxy/test.go rename to agent/proxyprocess/test.go index b6b35bb04b59..69de7a6da389 100644 --- a/agent/proxy/test.go +++ b/agent/proxyprocess/test.go @@ -1,4 +1,4 @@ -package proxy +package proxyprocess // defaultTestProxy is the test proxy that is instantiated for proxies with // an execution mode of ProxyExecModeTest. diff --git a/command/connect/proxy/proxy.go b/command/connect/proxy/proxy.go index 48ea721d55f8..987d0aa3a6cd 100644 --- a/command/connect/proxy/proxy.go +++ b/command/connect/proxy/proxy.go @@ -12,7 +12,7 @@ import ( "sort" "strconv" - proxyAgent "github.com/hashicorp/consul/agent/proxy" + proxyAgent "github.com/hashicorp/consul/agent/proxyprocess" "github.com/hashicorp/consul/api" "github.com/hashicorp/consul/command/flags" proxyImpl "github.com/hashicorp/consul/connect/proxy"