Skip to content

Commit

Permalink
fixup! cmd: implement changes to iptables.TrafficRedirectionSpec
Browse files Browse the repository at this point in the history
Revert name change of the upstreamHost variable
  • Loading branch information
roobre committed Jul 6, 2023
1 parent 519f7ea commit a5b1dcc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions cmd/agent/commands/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func BuildGrpcCmd(env runtime.Environment, config *agent.Config) *cobra.Command
disruption := grpc.Disruption{}
var duration time.Duration
var port uint
var targetHost string
var upstreamHost string
var targetPort uint
transparent := true

Expand All @@ -35,7 +35,7 @@ func BuildGrpcCmd(env runtime.Environment, config *agent.Config) *cobra.Command
}

listenAddress := net.JoinHostPort("", fmt.Sprint(port))
upstreamAddress := net.JoinHostPort(targetHost, fmt.Sprint(targetPort))
upstreamAddress := net.JoinHostPort(upstreamHost, fmt.Sprint(targetPort))

proxyConfig := grpc.ProxyConfig{
ListenAddress: listenAddress,
Expand Down Expand Up @@ -88,7 +88,7 @@ func BuildGrpcCmd(env runtime.Environment, config *agent.Config) *cobra.Command
cmd.Flags().StringSliceVarP(&disruption.Excluded, "exclude", "x", []string{}, "comma-separated list of grpc services"+
" to be excluded from disruption")
cmd.Flags().BoolVar(&transparent, "transparent", true, "run as transparent proxy")
cmd.Flags().StringVar(&targetHost, "upstream-host", "localhost",
cmd.Flags().StringVar(&upstreamHost, "upstream-host", "localhost",
"upstream host to redirect traffic to")

return cmd
Expand Down
6 changes: 3 additions & 3 deletions cmd/agent/commands/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func BuildHTTPCmd(env runtime.Environment, config *agent.Config) *cobra.Command
disruption := http.Disruption{}
var duration time.Duration
var port uint
var targetHost string
var upstreamHost string
var targetPort uint
transparent := true

Expand All @@ -34,7 +34,7 @@ func BuildHTTPCmd(env runtime.Environment, config *agent.Config) *cobra.Command
}

listenAddress := net.JoinHostPort("", fmt.Sprint(port))
upstreamAddress := "http://" + net.JoinHostPort(targetHost, fmt.Sprint(targetPort))
upstreamAddress := "http://" + net.JoinHostPort(upstreamHost, fmt.Sprint(targetPort))

proxyConfig := http.ProxyConfig{
ListenAddress: listenAddress,
Expand Down Expand Up @@ -86,7 +86,7 @@ func BuildHTTPCmd(env runtime.Environment, config *agent.Config) *cobra.Command
cmd.Flags().StringSliceVarP(&disruption.Excluded, "exclude", "x", []string{}, "comma-separated list of path(s)"+
" to be excluded from disruption")
cmd.Flags().BoolVar(&transparent, "transparent", true, "run as transparent proxy")
cmd.Flags().StringVar(&targetHost, "upstream-host", "localhost",
cmd.Flags().StringVar(&upstreamHost, "upstream-host", "localhost",
"upstream host to redirect traffic to")
cmd.Flags().UintVarP(&port, "port", "p", 8080, "port the proxy will listen to")
cmd.Flags().UintVarP(&targetPort, "target", "t", 0, "port the proxy will redirect request to")
Expand Down

0 comments on commit a5b1dcc

Please sign in to comment.