Documentation
¶
Index ¶
- Constants
- func AtStage(err error, stage string) error
- func Connect(ctx context.Context, profile protocol.SshProfile, ...) (*cryptossh.Client, error)
- func ConnectWithRecovery(ctx context.Context, clock clockwork.Clock, profile protocol.SshProfile, ...) (*cryptossh.Client, error)
- func Download(client *sftp.Client, path string, local io.Writer) (uint64, string, error)
- func Interrupted(stage string) error
- func List(client *sftp.Client, path string, after *protocol.SshCursor) (protocol.SshDirectory, error)
- func Modify(client *sftp.Client, path string, action protocol.SshFileAction) error
- func OpenSFTP(client *cryptossh.Client) (*sftp.Client, error)
- func PageEntries(entries []protocol.FileEntry, after *protocol.SshCursor) ([]protocol.FileEntry, *protocol.SshCursor)
- func Run(ctx context.Context, client *cryptossh.Client, command string) (protocol.SshOutcome, error)
- func TransferDownload(client *sftp.Client, path string, local io.Writer) (uint64, string, error)
- func TransferUpload(client *sftp.Client, source *os.File, localPath, remotePath string) (uint64, error)
- func Upload(client *sftp.Client, path string, source io.Reader, size uint64, ...) (uint64, error)
- func ValidatePath(path string) error
- func ValidateRemotePath(path string) error
- func VerifyHostKey(trusted *protocol.SshHostKey, key cryptossh.PublicKey) error
- type HostKeyRequired
Constants ¶
const TransferLimit = 1 << 30
TransferLimit bounds every SSH file transfer in either direction.
Variables ¶
This section is empty.
Functions ¶
func Connect ¶
func Connect(ctx context.Context, profile protocol.SshProfile, credential protocol.SshCredential) (*cryptossh.Client, error)
func ConnectWithRecovery ¶
func ConnectWithRecovery(ctx context.Context, clock clockwork.Clock, profile protocol.SshProfile, credential protocol.SshCredential) (*cryptossh.Client, error)
ConnectWithRecovery wraps Connect with the bounded pre-authentication recovery. Connect hides its TCP error, so after a dial failure on macOS one classification dial decides whether the host was unreachable. Handshake, authentication, SFTP and remote effects are never repeated.
func Download ¶
Download stages a browsed remote file and returns its size and BLAKE3 revision. Nothing remote changes, so every failure is definite.
func Interrupted ¶
Interrupted reports a transfer whose destination state is unconfirmed.
func List ¶
func List(client *sftp.Client, path string, after *protocol.SshCursor) (protocol.SshDirectory, error)
List reads one sorted page of a canonicalized remote directory.
func PageEntries ¶
func PageEntries(entries []protocol.FileEntry, after *protocol.SshCursor) ([]protocol.FileEntry, *protocol.SshCursor)
PageEntries orders directories first, then exact byte order of names, and returns the page after the cursor with the continuation when more remain.
func Run ¶
func Run(ctx context.Context, client *cryptossh.Client, command string) (protocol.SshOutcome, error)
Run executes one remote command and retains bounded output. Cancelling ctx closes the channel and returns ctx.Err(); the remote process may continue, so the caller reports that outcome as unknown.
func TransferDownload ¶
TransferDownload copies a remote file for worktree publication. Remote failures are uncertain and carry the stage that could not be confirmed.
func TransferUpload ¶
func TransferUpload(client *sftp.Client, source *os.File, localPath, remotePath string) (uint64, error)
TransferUpload copies an opened worktree file to the remote host. The file a transfer creates is private to the remote account.
func Upload ¶
func Upload(client *sftp.Client, path string, source io.Reader, size uint64, overwrite bool) (uint64, error)
Upload publishes a staged upload to its explicit remote path. An existing entry is a conflict unless the stage asked to overwrite it.
func ValidatePath ¶
ValidatePath accepts an explicit remote destination. Remote paths are not a sandbox: the saved profile's account decides what they can reach.
func ValidateRemotePath ¶
ValidateRemotePath applies the stricter transfer rule: no control characters.
func VerifyHostKey ¶
func VerifyHostKey(trusted *protocol.SshHostKey, key cryptossh.PublicKey) error
Types ¶
type HostKeyRequired ¶
type HostKeyRequired struct {
Key protocol.SshHostKey
Changed bool
}
func (*HostKeyRequired) Error ¶
func (*HostKeyRequired) Error() string
func (*HostKeyRequired) Outcome ¶
func (required *HostKeyRequired) Outcome() protocol.SshOutcome