utils

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NULL = []byte{'\x00'}

NULL is an array with a single NULL byte.

Functions

func ErrorHandler

func ErrorHandler(session ssh.Session, err error)

func KeyText

func KeyText(session ssh.Session) (string, error)

func NewLimitReader

func NewLimitReader(r io.Reader, limit int) io.Reader

func PrintMsg

func PrintMsg(session ssh.Session, stdout []string, stderr []error)

Types

type CopyFromClientHandler

type CopyFromClientHandler interface {
	// Write should write the given file.
	Write(ssh.Session, *FileEntry) (string, error)
	Read(ssh.Session, string) (os.FileInfo, io.ReaderAt, error)
	List(ssh.Session, string) ([]os.FileInfo, error)
	Validate(ssh.Session) error
}

CopyFromClientHandler is a handler that can be implemented to handle files being copied from the client to the server.

type FileEntry

type FileEntry struct {
	Name     string
	Filepath string
	Mode     fs.FileMode
	Size     int64
	Reader   io.Reader
	Atime    int64
	Mtime    int64
}

FileEntry is an Entry that reads from a Reader, defining a file and its contents.

func (*FileEntry) Write

func (e *FileEntry) Write(w io.Writer) error

Write a file to the given writer.

type LimitReader

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

func (*LimitReader) Read

func (r *LimitReader) Read(b []byte) (int, error)

type VirtualFile

type VirtualFile struct {
	FName    string
	FIsDir   bool
	FSize    int64
	FModTime time.Time
	FSys     any
}

func (*VirtualFile) IsDir

func (f *VirtualFile) IsDir() bool

func (*VirtualFile) ModTime

func (f *VirtualFile) ModTime() time.Time

func (*VirtualFile) Mode

func (f *VirtualFile) Mode() os.FileMode

func (*VirtualFile) Name

func (f *VirtualFile) Name() string

func (*VirtualFile) Size

func (f *VirtualFile) Size() int64

func (*VirtualFile) Sys

func (f *VirtualFile) Sys() any

Jump to

Keyboard shortcuts

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