Skip to content

Commit

Permalink
Update tsh latency ssh to use resolution RPC
Browse files Browse the repository at this point in the history
  • Loading branch information
rosstimothy committed Dec 18, 2024
1 parent 5ddd981 commit f964532
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions tool/tsh/common/tsh.go
Original file line number Diff line number Diff line change
Expand Up @@ -3722,19 +3722,15 @@ func onSSHLatency(cf *CLIConf) error {
}
defer clt.Close()

// detect the common error when users use host:port address format
_, port, err := net.SplitHostPort(tc.Host)
// client has used host:port notation
if err == nil {
return trace.BadParameter("please use ssh subcommand with '--port=%v' flag instead of semicolon", port)
target, err := tc.GetTargetNode(cf.Context, clt.AuthClient, nil)
if err != nil {
return trace.Wrap(err)
}

addr := net.JoinHostPort(tc.Host, strconv.Itoa(tc.HostPort))

nodeClient, err := tc.ConnectToNode(
cf.Context,
clt,
client.NodeDetails{Addr: addr, Namespace: tc.Namespace, Cluster: tc.SiteName},
client.NodeDetails{Addr: target.Addr, Namespace: tc.Namespace, Cluster: tc.SiteName},
tc.Config.HostLogin,
)
if err != nil {
Expand Down

0 comments on commit f964532

Please sign in to comment.