Documentation ¶
Overview ¶
Package client provides the client interface for 'file'
Index ¶
- func CopyRemoteFile(ctx context.Context, conn *proxy.Conn, source string, destination *FileConfig) error
- func ReadRemoteFile(ctx context.Context, conn *proxy.Conn, path string) ([]byte, error)
- func RemoveRemoteFile(ctx context.Context, conn *proxy.Conn, path string) error
- func WriteRemoteFile(ctx context.Context, conn *proxy.Conn, config *FileConfig, contents []byte) error
- type FileConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CopyRemoteFile ¶
func CopyRemoteFile(ctx context.Context, conn *proxy.Conn, source string, destination *FileConfig) error
CopyRemoteFile is a helper function for copying a file on a remote host using a proxy.Conn. If the conn is defined for >1 targets this will return an error.
func ReadRemoteFile ¶
ReadRemoteFile is a helper function for reading a single file from a remote host using a proxy.Conn. If the conn is defined for >1 targets this will return an error.
func RemoveRemoteFile ¶ added in v1.14.3
RemoveRemoteFile is a helper function for removing a file on a remote host using a proxy.Conn. If the conn is defined for >1 targets this will return an error.
func WriteRemoteFile ¶
func WriteRemoteFile(ctx context.Context, conn *proxy.Conn, config *FileConfig, contents []byte) error
WriteRemoteFile is a helper function for writing a single file to a remote host using a proxy.Conn. If the conn is defined for >1 targets this will return an error.
Types ¶
type FileConfig ¶
type FileConfig struct { // Filename is the remote full path to write the file. Filename string // User is the remote user to chown() the file ownership. User string // Group is the remote group to chgrp() the file group. Group string // Perms are the standard unix file permissions for the remote file. Perms int // If overwrite is true the remote file will be overwritten if it exists, // otherwise it's an error to write to an existing file. Overwrite bool }
FileConfig defines a configuration defining a remote file. This will be used when defining a remote written file such as writing a new file or copying one.