sftpsession

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2026 License: MIT Imports: 17 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	StatusConnecting = "connecting"
	StatusActive     = "active"
	StatusClosed     = "closed"
	StatusFailed     = "failed"
)

Variables

View Source
var ErrSessionNotActive = errors.New("SFTP session is not active")

Functions

This section is empty.

Types

type Conflict

type Conflict struct {
	Source      string `json:"source"`
	Destination string `json:"destination"`
}

type Directory

type Directory struct {
	Path    string      `json:"path"`
	Entries []FileEntry `json:"entries"`
}

type FileEntry

type FileEntry struct {
	Name        string `json:"name"`
	Path        string `json:"path"`
	Type        string `json:"type"`
	Size        int64  `json:"size"`
	ModifiedAt  string `json:"modifiedAt"`
	Permissions string `json:"permissions"`
}

type Manager

type Manager struct {
	Prepare         Preparer
	HostKeyCallback func(context.Context) (ssh.HostKeyCallback, error)
	Open            OpenFunc
	Timeout         time.Duration
	EmitState       func(StateEvent)
	EmitTransfer    func(TransferEvent)
	// contains filtered or unexported fields
}

func (*Manager) CancelTransfer

func (m *Manager) CancelTransfer(id string) error

func (*Manager) ClearCompleted

func (m *Manager) ClearCompleted(sessionID string)

func (*Manager) Close

func (m *Manager) Close(id string) error

func (*Manager) CloseAll

func (m *Manager) CloseAll() error

func (*Manager) HasActiveTransfers

func (m *Manager) HasActiveTransfers() bool

func (*Manager) HomeDirectory

func (m *Manager) HomeDirectory(id string) (string, error)

func (*Manager) List

func (m *Manager) List() []StateEvent

func (*Manager) ListTransfers

func (m *Manager) ListTransfers(sessionID string) []TransferEvent

func (*Manager) MakeDirectory

func (m *Manager) MakeDirectory(id, directory string) error

func (*Manager) ReadDirectory

func (m *Manager) ReadDirectory(id, directory string) (Directory, error)

func (*Manager) Remove

func (m *Manager) Remove(id string, paths []string) error

func (*Manager) Rename

func (m *Manager) Rename(id, source, newName string) error

func (*Manager) ResolveConflict

func (m *Manager) ResolveConflict(id, choice string, applyToBatch bool) error

func (*Manager) RetryTransfer

func (m *Manager) RetryTransfer(id string) (TransferEvent, error)

func (*Manager) Start

func (m *Manager) Start(parent context.Context, request StartRequest) (StateEvent, error)

func (*Manager) StartTransfer

func (m *Manager) StartTransfer(request TransferRequest) ([]TransferEvent, error)

type OpenFunc

type OpenFunc func(context.Context, OpenOptions) (RemoteClient, error)

type OpenOptions

type OpenOptions struct {
	Connection      jumpserver.ClientConnection
	Asset           jumpserver.AssetDetail
	Account         jumpserver.Account
	HostKeyCallback ssh.HostKeyCallback
	Timeout         time.Duration
}

type Permissions

type Permissions struct {
	Upload   *bool `json:"upload,omitempty"`
	Download *bool `json:"download,omitempty"`
	Delete   *bool `json:"delete,omitempty"`
}

type Preparer

type Preparer interface {
	Prepare(context.Context, connectapp.Options) (connectapp.Prepared, error)
}

type RemoteClient

type RemoteClient interface {
	Getwd() (string, error)
	RealPath(string) (string, error)
	InitialDirectory(string) (string, error)
	ReadDir(string) ([]os.FileInfo, error)
	Lstat(string) (os.FileInfo, error)
	Open(string) (io.ReadCloser, error)
	OpenFile(string, int) (io.WriteCloser, error)
	Mkdir(string) error
	Rename(string, string) error
	Remove(string) error
	RemoveDirectory(string) error
	Close() error
	Wait() error
}

type StartRequest

type StartRequest struct {
	Profile            string `json:"profile"`
	Organization       string `json:"organization"`
	Target             string `json:"target"`
	Account            string `json:"account"`
	Directory          string `json:"directory"`
	SourceSSHSessionID string `json:"sourceSSHSessionId"`
}

type StateEvent

type StateEvent struct {
	Asset        string       `json:"asset"`
	Permissions  *Permissions `json:"permissions,omitempty"`
	ID           string       `json:"id"`
	Status       string       `json:"status"`
	Title        string       `json:"title"`
	Profile      string       `json:"profile"`
	Organization string       `json:"organization"`
	Target       string       `json:"target"`
	Alias        string       `json:"alias"`
	AssetID      string       `json:"assetId"`
	AssetName    string       `json:"assetName"`
	Account      string       `json:"account"`
	Directory    string       `json:"directory"`
	Error        string       `json:"error"`
}

type TransferEvent

type TransferEvent struct {
	ID          string    `json:"id"`
	BatchID     string    `json:"batchId"`
	SessionID   string    `json:"sessionId"`
	Direction   string    `json:"direction"`
	Name        string    `json:"name"`
	Source      string    `json:"source"`
	Destination string    `json:"destination"`
	Status      string    `json:"status"`
	Transferred int64     `json:"transferred"`
	Total       int64     `json:"total"`
	Error       string    `json:"error"`
	Conflict    *Conflict `json:"conflict,omitempty"`
}

type TransferRequest

type TransferRequest struct {
	SessionID   string   `json:"sessionId"`
	Direction   string   `json:"direction"`
	Sources     []string `json:"sources"`
	Destination string   `json:"destination"`
}

Jump to

Keyboard shortcuts

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