Skip to content

Commit

Permalink
Rename proxy package (re-run of #4550) (#4638)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
banks committed Oct 10, 2018
1 parent 597576f commit 2d2d69e
Show file tree
Hide file tree
Showing 18 changed files with 20 additions and 20 deletions.
6 changes: 3 additions & 3 deletions agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion agent/proxy/daemon.go → agent/proxyprocess/daemon.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package proxy
package proxyprocess

import (
"fmt"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package proxy
package proxyprocess

import (
"io/ioutil"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// +build !darwin,!linux,!windows

package proxy
package proxyprocess

import "os"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// +build darwin linux windows

package proxy
package proxyprocess

import (
"os"
Expand Down
2 changes: 1 addition & 1 deletion agent/proxy/manager.go → agent/proxyprocess/manager.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package proxy
package proxyprocess

import (
"fmt"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package proxy
package proxyprocess

import (
"io/ioutil"
Expand Down
2 changes: 1 addition & 1 deletion agent/proxy/noop.go → agent/proxyprocess/noop.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package proxy
package proxyprocess

// Noop implements Proxy and does nothing.
type Noop struct{}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package proxy
package proxyprocess

import (
"testing"
Expand Down
2 changes: 1 addition & 1 deletion agent/proxy/process.go → agent/proxyprocess/process.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package proxy
package proxyprocess

import (
"strings"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// +build !windows

package proxy
package proxyprocess

import (
"fmt"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// +build windows

package proxy
package proxyprocess

import (
"os"
Expand Down
2 changes: 1 addition & 1 deletion agent/proxy/proxy.go → agent/proxyprocess/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package proxy
package proxyprocess

import (
"fmt"
Expand Down
2 changes: 1 addition & 1 deletion agent/proxy/root.go → agent/proxyprocess/root.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package proxy
package proxyprocess

import (
"os"
Expand Down
2 changes: 1 addition & 1 deletion agent/proxy/snapshot.go → agent/proxyprocess/snapshot.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package proxy
package proxyprocess

import (
"encoding/json"
Expand Down
2 changes: 1 addition & 1 deletion agent/proxy/test.go → agent/proxyprocess/test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package proxy
package proxyprocess

// defaultTestProxy is the test proxy that is instantiated for proxies with
// an execution mode of ProxyExecModeTest.
Expand Down
2 changes: 1 addition & 1 deletion command/connect/proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 2d2d69e

Please sign in to comment.