Replace Go SSH library with native ssh command

Major rewrite to use native ssh command instead of Go SSH library:

BREAKING CHANGE: Now requires ssh command in PATH

Benefits:
- Full SSH feature support including ProxyCommand
- Works with SSH containers and jump hosts
- Supports all SSH authentication methods
- Consistent behavior with terminal SSH
- No more custom SSH client implementation

Changes:
- Port detection now uses 'ssh hostname command'
- Port forwarding uses 'ssh -L localport:localhost:remoteport hostname'
- Connection testing uses native ssh command
- Removed golang.org/x/crypto/ssh dependency
- Updated documentation to reflect SSH compatibility

This fixes issues with SSH containers that require ProxyCommand
and provides full compatibility with user SSH configurations.

Co-authored-by: Ona <no-reply@ona.com>
This commit is contained in:
Ona
2025-09-26 00:32:35 +00:00
parent 02322c4a61
commit 9ec67e9b64
5 changed files with 170 additions and 276 deletions

View File

@@ -175,11 +175,15 @@ func (sc *SSHConfig) GetHosts() []SSHHost {
return sc.Hosts
}
// GetHostByName returns a specific host by name
// GetHostByName returns a specific host by name with expanded variables
func (sc *SSHConfig) GetHostByName(name string) (*SSHHost, error) {
for _, host := range sc.Hosts {
if host.Name == name {
return &host, nil
// Return a copy with expanded shell variables
expandedHost := host
expandedHost.User = expandShellVars(host.User)
expandedHost.Identity = expandShellVars(host.Identity)
return &expandedHost, nil
}
}
return nil, fmt.Errorf("host '%s' not found", name)