sftpmanager

package
v5.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2023 License: AGPL-3.0 Imports: 18 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultConnector

func DefaultConnector(c *Config) (*sftp.Client, error)
func Search(client *sftp.Client, query string, typ string, nums ...int) []string

Types

type Config

type Config struct {
	Host       string `db:"host" bson:"host" comment:"主机名" json:"host" xml:"host"`
	Port       int    `db:"port" bson:"port" comment:"端口" json:"port" xml:"port"`
	Username   string `db:"username" bson:"username" comment:"用户名" json:"username" xml:"username"`
	Password   string `db:"password" bson:"password" comment:"密码" json:"password" xml:"password"`
	PrivateKey string `db:"private_key" bson:"private_key" comment:"私钥内容" json:"private_key" xml:"private_key"`
	Passphrase string `db:"passphrase" bson:"passphrase" comment:"私钥口令" json:"passphrase" xml:"passphrase"`
}

Config 配置

func (*Config) Connect

func (c *Config) Connect() (*sftp.Client, error)

type Connector

type Connector func(*Config) (*sftp.Client, error)

type SftpManager

type SftpManager struct {
	EditableMaxSize int
	// contains filtered or unexported fields
}

func New

func New(connector Connector, config *Config, editableMaxSize int) *SftpManager

func (*SftpManager) Chmod

func (s *SftpManager) Chmod(ctx echo.Context, ppath string, mode os.FileMode) error

func (*SftpManager) Chown

func (s *SftpManager) Chown(ctx echo.Context, ppath string, uid, gid int) error

func (*SftpManager) Client

func (s *SftpManager) Client() *sftp.Client

func (*SftpManager) Close

func (s *SftpManager) Close() error

func (*SftpManager) ConnError

func (s *SftpManager) ConnError() error

func (*SftpManager) Connect

func (s *SftpManager) Connect() error

func (*SftpManager) Edit

func (s *SftpManager) Edit(ctx echo.Context, ppath string, content string, encoding string) (interface{}, error)

func (*SftpManager) List

func (s *SftpManager) List(ctx echo.Context, ppath string, sortBy ...string) (err error, exit bool, dirs []os.FileInfo)

func (*SftpManager) ListTransfer

func (s *SftpManager) ListTransfer(dirs []os.FileInfo) (dirList []echo.H, fileList []echo.H)

func (*SftpManager) Mkdir

func (s *SftpManager) Mkdir(ctx echo.Context, ppath, newName string) error

func (*SftpManager) MkdirAll added in v5.2.1

func (s *SftpManager) MkdirAll(_ context.Context, dirPath string) error

func (*SftpManager) Put added in v5.2.1

func (s *SftpManager) Put(ctx context.Context, reader io.Reader, ppath string, size int64) (err error)

func (*SftpManager) Remove

func (s *SftpManager) Remove(ppath string) error

func (*SftpManager) RemoveDir added in v5.2.1

func (s *SftpManager) RemoveDir(ppath string) error

func (*SftpManager) Rename

func (s *SftpManager) Rename(ctx echo.Context, ppath, newName string) error

func (*SftpManager) Search

func (s *SftpManager) Search(ppath string, prefix string, num int) []string

func (*SftpManager) Upload

func (s *SftpManager) Upload(ctx echo.Context, ppath string,
	chunkUpload *uploadClient.ChunkUpload,
	chunkOpts ...uploadClient.ChunkInfoOpter) error

Jump to

Keyboard shortcuts

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