Skip to content

Commit

Permalink
Remove hint from tsh aws (#45168)
Browse files Browse the repository at this point in the history
  • Loading branch information
greedy52 authored Aug 6, 2024
1 parent 9073de9 commit 0919a6d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
18 changes: 4 additions & 14 deletions tool/tsh/common/app_local_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,6 @@ func (a *localProxyApp) StartLocalProxy(ctx context.Context, opts ...alpnproxy.L
if err := a.startLocalALPNProxy(ctx, a.port, false /*withTLS*/, opts...); err != nil {
return trace.Wrap(err)
}

if a.port == "" {
fmt.Println("To avoid port randomization, you can choose the listening port using the --port flag.")
}
return nil
}

Expand All @@ -72,10 +68,6 @@ func (a *localProxyApp) StartLocalProxyWithTLS(ctx context.Context, opts ...alpn
if err := a.startLocalALPNProxy(ctx, a.port, true /*withTLS*/, opts...); err != nil {
return trace.Wrap(err)
}

if a.port == "" {
fmt.Println("To avoid port randomization, you can choose the listening port using the --port flag.")
}
return nil
}

Expand All @@ -88,10 +80,6 @@ func (a *localProxyApp) StartLocalProxyWithForwarder(ctx context.Context, forwar
if err := a.startLocalForwardProxy(ctx, a.port, forwardMatcher); err != nil {
return trace.Wrap(err)
}

if a.port == "" {
fmt.Println("To avoid port randomization, you can choose the listening port using the --port flag.")
}
return nil
}

Expand Down Expand Up @@ -154,8 +142,6 @@ func (a *localProxyApp) startLocalALPNProxy(ctx context.Context, port string, wi
return trace.Wrap(err)
}

fmt.Printf("Proxying connections to %s on %v\n", a.appInfo.RouteToApp.Name, a.localALPNProxy.GetAddr())

go func() {
if err = a.localALPNProxy.Start(ctx); err != nil {
log.WithError(err).Errorf("Failed to start local ALPN proxy.")
Expand Down Expand Up @@ -206,3 +192,7 @@ func (a *localProxyApp) startLocalForwardProxy(ctx context.Context, port string,
}()
return nil
}

func (a *localProxyApp) GetAddr() string {
return a.localALPNProxy.GetAddr()
}
5 changes: 5 additions & 0 deletions tool/tsh/common/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,11 @@ func onProxyCommandApp(cf *CLIConf) error {
return trace.Wrap(err)
}

fmt.Printf("Proxying connections to %s on %v\n", cf.AppName, proxyApp.GetAddr())
if cf.LocalProxyPort == "" {
fmt.Println("To avoid port randomization, you can choose the listening port using the --port flag.")
}

defer func() {
if err := proxyApp.Close(); err != nil {
log.WithError(err).Error("Failed to close app proxy.")
Expand Down

0 comments on commit 0919a6d

Please sign in to comment.