Documentation ¶
Index ¶
- type Client
- type ClientWrapper
- func (c *ClientWrapper) CanRunRemoteCommand(cmd string) bool
- func (c *ClientWrapper) Close() error
- func (c *ClientWrapper) Delete(dst string) error
- func (c *ClientWrapper) Mkdir(dst string) error
- func (c *ClientWrapper) NewSession() (*ssh.Session, error)
- func (c *ClientWrapper) Open(path string) (*_sftp.File, error)
- func (c *ClientWrapper) ReadDir(path string) ([]os.FileInfo, error)
- func (c *ClientWrapper) RunRemoteCommand(command string) (io.Reader, error)
- func (c *ClientWrapper) Upload(r io.Reader, dst string) error
- type FileUploadDeleter
- type RemoteCommandRunner
- type RemoteFileReader
- type SSHCredentials
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶ added in v1.0.0
type Client interface { RemoteCommandRunner FileUploadDeleter RemoteFileReader }
A Client is the full interface for interacting with the remote server. It combines the interfaces above.
type ClientWrapper ¶
type ClientWrapper struct {
// contains filtered or unexported fields
}
ClientWrapper Our ClientWrapper is a wrapper around the pkg/sftp Client that only exposes the methods that we actually need.
func NewClient ¶
func NewClient(credentials SSHCredentials) (*ClientWrapper, error)
func (*ClientWrapper) CanRunRemoteCommand ¶
func (c *ClientWrapper) CanRunRemoteCommand(cmd string) bool
func (*ClientWrapper) Close ¶
func (c *ClientWrapper) Close() error
func (*ClientWrapper) Delete ¶
func (c *ClientWrapper) Delete(dst string) error
func (*ClientWrapper) Mkdir ¶ added in v1.0.0
func (c *ClientWrapper) Mkdir(dst string) error
func (*ClientWrapper) NewSession ¶
func (c *ClientWrapper) NewSession() (*ssh.Session, error)
func (*ClientWrapper) RunRemoteCommand ¶
func (c *ClientWrapper) RunRemoteCommand(command string) (io.Reader, error)
type FileUploadDeleter ¶ added in v1.0.0
type FileUploadDeleter interface { Upload(r io.Reader, dst string) error Delete(dst string) error Mkdir(dst string) error }
FileUploadDeleter is an interface that allows us to upload, delete, and create directories on the remote server. An object may choose to use this interface instead of a full Client if it only needs to upload/delete files.
type RemoteCommandRunner ¶ added in v1.0.0
type RemoteCommandRunner interface { CanRunRemoteCommand(command string) bool RunRemoteCommand(command string) (io.Reader, error) }
RemoteCommandRunner is an interface that allows us to check if the remote server can run a command, and then run it. An object may choose to use this interface instead of a full Client if it only needs to run commands.
type RemoteFileReader ¶ added in v1.0.0
type RemoteFileReader interface { ReadDir(path string) ([]os.FileInfo, error) Open(path string) (*_sftp.File, error) NewSession() (*ssh.Session, error) }
FileEmitter is an interface that allows us to download files from the remote server. An object may choose to use this interface instead of a full Client if it only needs to download files.