Documentation
¶
Overview ¶
Package ssh provides SSH connection management for cbwsh.
Index ¶
- func HostKeyCallback(knownHostsPath string) ssh.HostKeyCallback
- func ParseSSHURI(uri string) (user, host string, port int, err error)
- type Manager
- func (m *Manager) AddHostToKnownHosts(hostname string, remote net.Addr, key ssh.PublicKey) error
- func (m *Manager) Connect(ctx context.Context, host string, port int, user string) error
- func (m *Manager) ConnectToSavedHost(ctx context.Context, name string) error
- func (m *Manager) ConnectWithKey(ctx context.Context, host string, port int, user, keyPath, passphrase string) error
- func (m *Manager) ConnectWithPassword(ctx context.Context, host string, port int, user, password string) error
- func (m *Manager) CurrentHost() *core.SSHHost
- func (m *Manager) Disconnect() error
- func (m *Manager) Execute(ctx context.Context, command string) (*core.CommandResult, error)
- func (m *Manager) ForwardLocalPort(ctx context.Context, localPort int, remoteHost string, remotePort int) error
- func (m *Manager) IsHostKnown(hostname string) bool
- func (m *Manager) ListSavedHosts() ([]core.SSHHost, error)
- func (m *Manager) RemoveHost(name string) error
- func (m *Manager) SaveHost(host core.SSHHost) error
- func (m *Manager) SetKnownHostsPath(path string)
- func (m *Manager) SetStrictHostKeyChecking(strict bool)
- func (m *Manager) State() core.SSHConnectionState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HostKeyCallback ¶
func HostKeyCallback(knownHostsPath string) ssh.HostKeyCallback
HostKeyCallback returns a host key callback that checks known hosts. Deprecated: Use SetStrictHostKeyChecking and connect methods instead.
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager handles SSH connections and host management.
func NewManager ¶
NewManager creates a new SSH manager.
func (*Manager) AddHostToKnownHosts ¶
AddHostToKnownHosts adds a host key to the known_hosts file.
func (*Manager) ConnectToSavedHost ¶
ConnectToSavedHost connects to a saved host by name.
func (*Manager) ConnectWithKey ¶
func (m *Manager) ConnectWithKey(ctx context.Context, host string, port int, user, keyPath, passphrase string) error
ConnectWithKey establishes an SSH connection using a key file.
func (*Manager) ConnectWithPassword ¶
func (m *Manager) ConnectWithPassword(ctx context.Context, host string, port int, user, password string) error
ConnectWithPassword establishes an SSH connection using password authentication.
func (*Manager) CurrentHost ¶
CurrentHost returns the currently connected host.
func (*Manager) Disconnect ¶
Disconnect closes the current SSH connection.
func (*Manager) ForwardLocalPort ¶
func (m *Manager) ForwardLocalPort(ctx context.Context, localPort int, remoteHost string, remotePort int) error
ForwardLocalPort creates a local port forwarding tunnel.
func (*Manager) IsHostKnown ¶
IsHostKnown checks if a host is in the known_hosts file.
func (*Manager) ListSavedHosts ¶
ListSavedHosts returns a list of saved SSH hosts.
func (*Manager) RemoveHost ¶
RemoveHost removes a saved SSH host.
func (*Manager) SetKnownHostsPath ¶
SetKnownHostsPath sets the path to the known_hosts file.
func (*Manager) SetStrictHostKeyChecking ¶
SetStrictHostKeyChecking enables or disables strict host key checking.
func (*Manager) State ¶
func (m *Manager) State() core.SSHConnectionState
State returns the current connection state.