Skip to content

Commit

Permalink
Merge pull request #19198 from callthingsoff/reuse_addr_in_TCPProxy_Run
Browse files Browse the repository at this point in the history
server/proxy/tcpproxy: reuse addr in TCPProxy.Run
  • Loading branch information
ahrtr authored Jan 18, 2025
2 parents 6187c95 + 88a1bc3 commit 831fa7a
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions server/proxy/tcpproxy/userspace.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,12 @@ func (tp *TCPProxy) Run() error {
if tp.MonitorInterval == 0 {
tp.MonitorInterval = 5 * time.Minute
}

var eps []string // for logging
for _, srv := range tp.Endpoints {
addr := net.JoinHostPort(srv.Target, fmt.Sprintf("%d", srv.Port))
tp.remotes = append(tp.remotes, &remote{srv: srv, addr: addr})
}

var eps []string
for _, ep := range tp.Endpoints {
eps = append(eps, fmt.Sprintf("%s:%d", ep.Target, ep.Port))
eps = append(eps, addr)
}
if tp.Logger != nil {
tp.Logger.Info("ready to proxy client requests", zap.Strings("endpoints", eps))
Expand Down

0 comments on commit 831fa7a

Please sign in to comment.