{"modulePath":"github.com/windsorcli/cli","version":"v0.8.1","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package ssh\n\n## Types\n\n```go\ntype AuthMethod interface {\n\tMethod() gossh.AuthMethod\n}\n```\nAuthMethod abstracts the SSH authentication method\n\n```go\ntype BaseClient struct {\n\t// contains filtered or unexported fields\n}\n```\nBaseClient provides a base implementation of the Client interface\n\n```go\nfunc (c *BaseClient) SetClientConfig(config *ClientConfig)\n```\nSetClientConfig sets the client configuration for the SSH client\n\n```go\nfunc (c *BaseClient) SetClientConfigFile(configStr, hostname string) error\n```\nSetClientConfigFile sets the client configuration from a string (either a filename or config content) and a hostname\n\n```go\ntype Client interface {\n\tDial(network, addr string, config *ClientConfig) (ClientConn, error)\n\tConnect() (ClientConn, error)\n\tSetClientConfig(config *ClientConfig)\n\tSetClientConfigFile(configStr, hostname string) error\n}\n```\nClient interface abstracts the SSH client\n\n```go\ntype ClientConfig struct {\n\tUser            string\n\tAuth            []AuthMethod\n\tHostKeyCallback HostKeyCallback\n\tHostName        string\n\tPort            string\n}\n```\nClientConfig abstracts the SSH client configuration\n\n```go\ntype ClientConn interface {\n\tClose() error\n\tNewSession() (Session, error)\n}\n```\nClientConn interface abstracts the SSH client connection\n\n```go\ntype HostKeyCallback interface {\n\tCallback() gossh.HostKeyCallback\n}\n```\nHostKeyCallback abstracts the SSH host key callback\n\n```go\ntype MockAuthMethod struct {\n\tMethodFunc func() any\n}\n```\nMockAuthMethod is the mock implementation of the AuthMethod interface\n\n```go\nfunc (m *MockAuthMethod) Method() gossh.AuthMethod\n```\nMethod returns the SSH authentication method\n\n```go\ntype MockClient struct {\n\tDialFunc                func(network, addr string, config *ClientConfig) (ClientConn, error)\n\tConnectFunc             func() (ClientConn, error)\n\tSetClientConfigFunc     func(config *ClientConfig)\n\tSetClientConfigFileFunc func(configStr, hostname string) error\n}\n```\nMockClient is the mock implementation of the Client interface\n\n```go\nfunc NewMockSSHClient() *MockClient\n```\nNewMockSSHClient creates a new MockClient with default function implementations\n\n```go\nfunc (m *MockClient) Connect() (ClientConn, error)\n```\nConnect connects to the SSH server using the provided client configuration\n\n```go\nfunc (m *MockClient) Dial(network, addr string, config *ClientConfig) (ClientConn, error)\n```\nDial connects to the SSH server and returns a client connection\n\n```go\nfunc (m *MockClient) SetClientConfig(config *ClientConfig)\n```\nSetClientConfig sets the client configuration\n\n```go\nfunc (m *MockClient) SetClientConfigFile(configStr, hostname string) error\n```\nSetClientConfigFile sets the client configuration from a file\n\n```go\ntype MockClientConn struct {\n\tNewSessionFunc func() (Session, error)\n\tCloseFunc      func() error\n}\n```\nMockClientConn is the mock implementation of the ClientConn interface\n\n```go\nfunc (m *MockClientConn) Close() error\n```\nClose closes the client connection\n\n```go\nfunc (m *MockClientConn) NewSession() (Session, error)\n```\nNewSession creates a new SSH session\n\n```go\ntype MockHostKeyCallback struct {\n\tCallbackFunc func() any\n}\n```\nMockHostKeyCallback is the mock implementation of the HostKeyCallback interface\n\n```go\nfunc (m *MockHostKeyCallback) Callback() gossh.HostKeyCallback\n```\nCallback returns the SSH host key callback\n\n```go\ntype MockPublicKeyAuthMethod struct {\n\tSignerFunc func() gossh.Signer\n}\n```\nMockPublicKeyAuthMethod is the mock implementation of the PublicKeyAuthMethod interface\n\n```go\nfunc (m *MockPublicKeyAuthMethod) Method() gossh.AuthMethod\n```\nMethod returns the SSH authentication method\n\n```go\ntype MockSession struct {\n\tRunFunc            func(cmd string) error\n\tCombinedOutputFunc func(cmd string) ([]byte, error)\n\tSetStdoutFunc      func(w io.Writer)\n\tSetStderrFunc      func(w io.Writer)\n\tCloseFunc          func() error\n}\n```\nMockSession is the mock implementation of the Session interface\n\n```go\nfunc (m *MockSession) Close() error\n```\nClose closes the session\n\n```go\nfunc (m *MockSession) CombinedOutput(cmd string) ([]byte, error)\n```\nCombinedOutput executes a command and returns its combined stdout and stderr\n\n```go\nfunc (m *MockSession) Run(cmd string) error\n```\nRun executes a command on the remote server\n\n```go\nfunc (m *MockSession) SetStderr(w io.Writer)\n```\nSetStderr sets the stderr writer for the session\n\n```go\nfunc (m *MockSession) SetStdout(w io.Writer)\n```\nSetStdout sets the stdout writer for the session\n\n```go\ntype PublicKeyAuthMethod struct {\n\t// contains filtered or unexported fields\n}\n```\nPublicKeyAuthMethod implements the AuthMethod interface using a public key\n\n```go\nfunc (p *PublicKeyAuthMethod) Method() gossh.AuthMethod\n```\nMethod returns the SSH authentication method\n\n```go\ntype RealClientConn struct {\n\t// contains filtered or unexported fields\n}\n```\nRealClientConn wraps \\*gossh.Client and implements the ClientConn interface\n\n```go\nfunc (c *RealClientConn) Close() error\n```\nClose closes the client connection\n\n```go\nfunc (c *RealClientConn) NewSession() (Session, error)\n```\nNewSession creates a new SSH session\n\n```go\ntype RealSession struct {\n\t// contains filtered or unexported fields\n}\n```\nRealSession wraps \\*gossh.Session and implements the Session interface\n\n```go\nfunc (s *RealSession) Close() error\n```\nClose closes the session\n\n```go\nfunc (s *RealSession) CombinedOutput(cmd string) ([]byte, error)\n```\nCombinedOutput executes a command and returns its combined stdout and stderr\n\n```go\nfunc (s *RealSession) Run(cmd string) error\n```\nRun executes a command on the remote server\n\n```go\nfunc (s *RealSession) SetStderr(w io.Writer)\n```\nSetStderr sets the stderr writer for the session\n\n```go\nfunc (s *RealSession) SetStdout(w io.Writer)\n```\nSetStdout sets the stdout writer for the session\n\n```go\ntype SSHClient struct {\n\tBaseClient\n}\n```\nSSHClient is the real implementation of the Client interface\n\n```go\nfunc NewSSHClient() *SSHClient\n```\nNewSSHClient creates a new SSHClient with the default SSH config path\n\n```go\nfunc (c *SSHClient) Connect() (ClientConn, error)\n```\nConnect connects to the SSH server using the provided client configuration\n\n```go\nfunc (c *SSHClient) Dial(network, addr string, config *ClientConfig) (ClientConn, error)\n```\nDial connects to the SSH server and returns a client connection\n\n```go\ntype Session interface {\n\tRun(cmd string) error\n\tCombinedOutput(cmd string) ([]byte, error)\n\tSetStdout(w io.Writer)\n\tSetStderr(w io.Writer)\n\tClose() error\n}\n```\nSession interface abstracts the SSH session\n\n","path":"github.com/windsorcli/cli/pkg/runtime/shell/ssh","name":"ssh","synopsis":"","isRedistributable":true}
