Documentation
¶
Index ¶
- func DefaultLocalPathForGet(remote string) string
- func DefaultRemotePathForPut(local string) string
- func Get(ctx context.Context, conn *ssh.Client, remotePath, localPath string) error
- func GetWithProgress(ctx context.Context, conn *ssh.Client, remotePath, localPath string, ...) error
- func GetWithProgressClosing(ctx context.Context, conn *ssh.Client, remotePath, localPath string, ...) error
- func LocalBaseName(localPath string) string
- func LocalPathWithDirDefault(remote, local string, localIsDir func(string) bool) string
- func ParseRemoteDest(dst string) (user, host, path string, err error)
- func Put(ctx context.Context, conn *ssh.Client, localPath, remotePath string) error
- func PutWithProgress(ctx context.Context, conn *ssh.Client, localPath, remotePath string, ...) error
- func PutWithProgressClosing(ctx context.Context, conn *ssh.Client, localPath, remotePath string, ...) error
- func RemoteBaseName(remotePath string) string
- func RemotePathWithDirDefault(local, remote string, remoteIsDir func(string) bool) string
- type CopyProgress
- type Direction
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultLocalPathForGet ¶
DefaultLocalPathForGet returns the default local destination for a get when omitted.
func DefaultRemotePathForPut ¶
DefaultRemotePathForPut returns the default remote destination for a put when omitted.
func Get ¶
Get downloads remotePath from conn to localPath (single regular file). ctx cancels the transfer. conn must be a live golang.org/x/crypto/ssh client. Errors: ctx.Err; SFTP/stat/open failures on remotePath; directory or non-regular remote paths; local write errors.
func GetWithProgress ¶
func GetWithProgress(ctx context.Context, conn *ssh.Client, remotePath, localPath string, progress CopyProgress) error
GetWithProgress is like Get but reports copy progress via progress when non-nil.
func GetWithProgressClosing ¶
func GetWithProgressClosing( ctx context.Context, conn *ssh.Client, remotePath, localPath string, progress CopyProgress, onClosing func(), ) error
GetWithProgressClosing is like GetWithProgress and invokes onClosing after copy, before file close.
func LocalBaseName ¶
LocalBaseName returns the final path element of a local file path.
func LocalPathWithDirDefault ¶
LocalPathWithDirDefault appends the remote basename when local names an existing directory.
func ParseRemoteDest ¶
ParseRemoteDest parses user@host:/path and user@[ipv6]:/path forms. Returns an error when host or path cannot be determined.
func Put ¶
Put uploads localPath to remotePath on conn (single regular file). Creates missing parent directories on the remote host before writing the file. ctx cancels the transfer. conn must be a live golang.org/x/crypto/ssh client. Errors: ctx.Err; local open/stat errors; SFTP mkdir/create/write errors; directory paths.
func PutWithProgress ¶
func PutWithProgress(ctx context.Context, conn *ssh.Client, localPath, remotePath string, progress CopyProgress) error
PutWithProgress is like Put but reports copy progress via progress when non-nil.
func PutWithProgressClosing ¶
func PutWithProgressClosing( ctx context.Context, conn *ssh.Client, localPath, remotePath string, progress CopyProgress, onClosing func(), ) error
PutWithProgressClosing is like PutWithProgress and invokes onClosing after copy, before file close.
func RemoteBaseName ¶
RemoteBaseName returns the final path element of a remote file path.
Types ¶
type CopyProgress ¶
type CopyProgress func(written, total int64)
CopyProgress reports bytes copied during SFTP transfer. total is 0 when unknown.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package route selects get/put backends (ZMODEM vs SFTP) for in-session transfer.
|
Package route selects get/put backends (ZMODEM vs SFTP) for in-session transfer. |
|
Package zmodem wraps the vendored xiwh ZMODEM stack for lrzsz-compatible PTY file transfer.
|
Package zmodem wraps the vendored xiwh ZMODEM stack for lrzsz-compatible PTY file transfer. |