sftp

package
v0.24.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 6, 2026 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientInfo

type ClientInfo struct {
	Fingerprint string // SSH public key fingerprint (e.g., "SHA256:...")
	SessionID   string // SSH session ID (identifies a single scp/sftp command)
}

ClientInfo contains information about the SFTP client

type Operation

type Operation int

Operation represents an SFTP operation type

const (
	OpDownload Operation = iota
	OpUpload
	OpDelete
	OpMkdir
	OpRmdir
	OpRename
	OpSymlink
	OpLink
	OpSetstat
)

func (Operation) String

func (o Operation) String() string

String returns a human-readable name for the operation

type PermissionChecker

type PermissionChecker interface {
	// CheckPermission returns the user's decision for the operation.
	// For single-path operations (download, upload, delete, etc.), pass one path.
	// For two-path operations (rename, symlink, link), pass source and target paths.
	// Returns error if the checker is unavailable (e.g., no display).
	CheckPermission(op Operation, client ClientInfo, paths ...string) (PermissionResult, error)

	// ClearSession removes any cached permissions for the given session.
	// Called when an SFTP session ends to prevent memory leaks.
	ClearSession(sessionID string)
}

PermissionChecker is called to check if an SFTP operation is allowed. Implementations can show UI dialogs, auto-allow, or deny based on policy.

type PermissionResult

type PermissionResult int

PermissionResult represents the user's response to a permission dialog

const (
	PermissionDenied PermissionResult = iota
	PermissionAllowed
	PermissionAlwaysAllow
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL