Documentation
¶
Index ¶
- func CleanupSSHKeys(clusterName string) error
- type Client
- func (c *Client) Close() error
- func (c *Client) Connect() error
- func (c *Client) DownloadFile(remotePath, localPath string) error
- func (c *Client) RunCommand(command string) (string, error)
- func (c *Client) UploadDirectory(localDirPath, remoteDirPath string) error
- func (c *Client) UploadFile(localPath, remotePath string) error
- type SSHConfig
- type SSHManager
- func (sm *SSHManager) Address(nodeName string) string
- func (sm *SSHManager) Close() error
- func (sm *SSHManager) CloseClient(nodeName string)
- func (sm *SSHManager) CreateClient(nodeName string, ip string) (*Client, error)
- func (sm *SSHManager) DownloadFile(nodeName, remotePath, localPath string) error
- func (sm *SSHManager) GetClient(nodeName string) (*Client, bool)
- func (sm *SSHManager) GetSSHConfig() *SSHConfig
- func (sm *SSHManager) RunCommand(nodeName, command string) (string, error)
- func (sm *SSHManager) StartHealthCheck()
- func (sm *SSHManager) StopHealthCheck()
- func (sm *SSHManager) TransferFile(nodeName, localPath, remotePath string) error
- func (sm *SSHManager) UploadDirectory(nodeName, localDirPath, remoteDirPath string) error
- func (sm *SSHManager) UploadFile(nodeName, localPath, remotePath string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CleanupSSHKeys ¶
CleanupSSHKeys removes SSH keys for a cluster
Types ¶
type Client ¶
type Client struct {
Host string
Port string
User string
Password string
PrivKey string
// contains filtered or unexported fields
}
Client is a wrapper for the SSH client
func (*Client) DownloadFile ¶
DownloadFile downloads a file from the remote server using SFTP protocol
func (*Client) RunCommand ¶
RunCommand runs a command on the SSH server, with retry mechanism
func (*Client) UploadDirectory ¶
UploadDirectory uploads a local directory to the remote server using SFTP protocol
func (*Client) UploadFile ¶
UploadFile uploads a local file to the remote server using SFTP protocol
type SSHConfig ¶
type SSHConfig struct {
Password string
SSHKeyFile string
SSHPubKeyFile string
// contains filtered or unexported fields
}
func NewSSHConfig ¶
NewSSHConfig creates a new SSH configuration with auto-generated keys for the cluster
func NewSSHConfigWithKeys ¶
func NewSSHConfigWithKeys(password string, sshKeyFile string, sshPubKeyFile string) (*SSHConfig, error)
NewSSHConfigWithKeys creates SSH configuration with provided key file paths (for backward compatibility)
func (*SSHConfig) GetSSHPubKey ¶
type SSHManager ¶
type SSHManager struct {
// contains filtered or unexported fields
}
SSHManager manages SSH clients and their lifecycle
func NewSSHManager ¶
func NewSSHManager(cluster *config.Cluster, sshConfig *SSHConfig) *SSHManager
NewSSHManager creates a new SSH manager
func (*SSHManager) Address ¶
func (sm *SSHManager) Address(nodeName string) string
func (*SSHManager) Close ¶
func (sm *SSHManager) Close() error
CloseAllClients closes all SSH clients
func (*SSHManager) CloseClient ¶
func (sm *SSHManager) CloseClient(nodeName string)
CloseClient closes the SSH client for the specified node
func (*SSHManager) CreateClient ¶
func (sm *SSHManager) CreateClient(nodeName string, ip string) (*Client, error)
func (*SSHManager) DownloadFile ¶
func (sm *SSHManager) DownloadFile(nodeName, remotePath, localPath string) error
DownloadFile downloads a file from a remote node to local path using proper SCP protocol
func (*SSHManager) GetClient ¶
func (sm *SSHManager) GetClient(nodeName string) (*Client, bool)
GetClient gets an SSH client
func (*SSHManager) GetSSHConfig ¶
func (sm *SSHManager) GetSSHConfig() *SSHConfig
GetSSHConfig returns the SSH configuration
func (*SSHManager) RunCommand ¶
func (sm *SSHManager) RunCommand(nodeName, command string) (string, error)
RunCommand executes a command on the specified node
func (*SSHManager) StartHealthCheck ¶
func (sm *SSHManager) StartHealthCheck()
StartHealthCheck starts the health check for SSH connections
func (*SSHManager) StopHealthCheck ¶
func (sm *SSHManager) StopHealthCheck()
StopHealthCheck stops the health check
func (*SSHManager) TransferFile ¶
func (sm *SSHManager) TransferFile(nodeName, localPath, remotePath string) error
TransferFile implements the SSHFileTransfer interface (for backward compatibility)
func (*SSHManager) UploadDirectory ¶
func (sm *SSHManager) UploadDirectory(nodeName, localDirPath, remoteDirPath string) error
UploadDirectory uploads a local directory to a remote node using proper SFTP protocol
func (*SSHManager) UploadFile ¶
func (sm *SSHManager) UploadFile(nodeName, localPath, remotePath string) error
UploadFile uploads a local file to a remote node using proper SCP protocol