sshsftp

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2026 License: GPL-3.0 Imports: 25 Imported by: 0

Documentation

Overview

Package sshsftp contains the shared SSH session and SFTP route implementation.

Index

Constants

View Source
const (
	CredentialSSHPrivateKey plugin.CredentialKind = "ssh_private_key"
	CredentialSSHPassword   plugin.CredentialKind = "ssh_password"
)

Variables

This section is empty.

Functions

func Connect

func Connect(ctx context.Context, cfg plugin.ConnectConfig) (plugin.Session, error)

Connect opens one SSH client for either the SSH or SFTP plugin.

func CredentialKinds

func CredentialKinds() []plugin.CredentialKindInfo

func Routes

func Routes(prefix, protocol string, includeShell bool) []plugin.Route

Routes returns the shared SFTP route handlers using the provided route prefix.

Types

type FileContent

type FileContent struct {
	Path      string `json:"path"`
	MIME      string `json:"mime,omitempty"`
	Encoding  string `json:"encoding,omitempty"`
	Content   string `json:"content,omitempty"`
	URL       string `json:"url,omitempty"`
	Size      int64  `json:"size,omitempty"`
	Truncated bool   `json:"truncated,omitempty"`
}

FileContent is the generic file_browser preview payload.

type FileEntry

type FileEntry struct {
	Name    string    `json:"name"`
	Path    string    `json:"path"`
	IsDir   bool      `json:"isDir"`
	Size    int64     `json:"size,omitempty"`
	MIME    string    `json:"mime,omitempty"`
	ModTime time.Time `json:"modTime,omitzero"`
	Mode    string    `json:"mode,omitempty"`
	Symlink string    `json:"symlink,omitempty"`
}

FileEntry is the generic file_browser listing row.

type FilePage

type FilePage struct {
	Items      []FileEntry `json:"items"`
	NextCursor string      `json:"nextCursor"`
	Total      *int        `json:"total,omitempty"`
	Path       string      `json:"path"`
}

type Session

type Session struct {
	// contains filtered or unexported fields
}

Session holds all mutable per-connection SSH state.

func NewSession

func NewSession(client *ssh.Client) *Session

NewSession wraps an authenticated SSH client.

func Unwrap

func Unwrap(sess plugin.Session) (*Session, error)

Unwrap returns the shared SSH/SFTP session from the core session handle.

func (*Session) Close

func (s *Session) Close() error

func (*Session) Filesystem

func (s *Session) Filesystem() (*sftp.Client, error)

Filesystem opens SFTP lazily over the existing SSH client.

func (*Session) HealthCheck

func (s *Session) HealthCheck(context.Context) error

func (*Session) OpenChannel

func (s *Session) OpenChannel(ctx context.Context, req plugin.ChannelRequest) (plugin.Channel, error)

func (*Session) RunCommand

func (s *Session) RunCommand(ctx context.Context, command string) (string, bool, error)

Jump to

Keyboard shortcuts

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