From 4f5b41983dbbd1db5312a4783374fac18a9faf28 Mon Sep 17 00:00:00 2001 From: hangxuan Date: Tue, 16 Jan 2024 12:16:07 +0800 Subject: [PATCH] Resolve the actual Hostname if in the config Hostname is %h --- tssh/login.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tssh/login.go b/tssh/login.go index aa88df5..01c9b52 100644 --- a/tssh/login.go +++ b/tssh/login.go @@ -115,11 +115,13 @@ func getLoginParam(args *sshArgs) (*loginParam, error) { args.Destination = destHost // login host - hostName := getConfig(destHost, "HostName") - if hostName != "" { - param.host = hostName - } else { - param.host = destHost + param.host = destHost + if hostName := getConfig(destHost, "HostName"); hostName != "" { + var err error + param.host, err = expandTokens(hostName, args, param, "%h") + if err != nil { + return nil, err + } } // login user