utilsFtp

package
v0.0.0-...-7ec6a99 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	Type FtpsEntryType
	Name string
	Size uint64
	Time time.Time
}

type FTPClient

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

FTPClient FTP客户端

func NewFTPClient

func NewFTPClient(cfg *FTPRequest) (*FTPClient, error)

func (*FTPClient) ChangeDir

func (c *FTPClient) ChangeDir(remotePath string) error

func (*FTPClient) Keepalive

func (c *FTPClient) Keepalive() error

func (*FTPClient) List

func (c *FTPClient) List() ([]*ftp.Entry, error)

func (*FTPClient) MkDir

func (c *FTPClient) MkDir(remotePath string) error

func (*FTPClient) MkDirOneByOne

func (c *FTPClient) MkDirOneByOne(remotePath string) error

func (*FTPClient) Put

func (c *FTPClient) Put(filepath string, filename string, remotePath string) error

func (*FTPClient) Quit

func (c *FTPClient) Quit()

func (*FTPClient) Rename

func (c *FTPClient) Rename(oldname string, newname string) error

type FTPRequest

type FTPRequest struct {
	Host        string        // FTP地址,IP:PORT
	TLSConfig   *tls.Config   //ssl连接配置
	Username    string        //FTP用户名
	Password    string        //FTP密码
	StartDir    string        //起始目录
	DialTimeout time.Duration //连接超时
	Result      []byte        //请求结果
	InnerErr    error         // The Error Message
}

FTPRequest 新的请求结构

type FtpsEntryType

type FtpsEntryType int
const (
	FtpsEntryTypeFile FtpsEntryType = iota
	FtpsEntryTypeFolder
	FtpsEntryTypeLink
)

type SFTP

type SFTP struct {
	Debug     bool
	TLSConfig tls.Config
	// contains filtered or unexported fields
}

func (*SFTP) ChangeWorkingDirectory

func (s *SFTP) ChangeWorkingDirectory(path string) (err error)

func (*SFTP) Connect

func (s *SFTP) Connect(host string, port int) (err error)

func (*SFTP) DeleteFile

func (s *SFTP) DeleteFile(path string) (err error)

func (*SFTP) List

func (s *SFTP) List() (entries []Entry, err error)

func (*SFTP) Login

func (s *SFTP) Login(username, password string) (err error)

func (*SFTP) MakeDirectory

func (s *SFTP) MakeDirectory(path string) (err error)

func (*SFTP) MkDirOneByOne

func (s *SFTP) MkDirOneByOne(remotePath string) error

func (*SFTP) PrintWorkingDirectory

func (s *SFTP) PrintWorkingDirectory() (directory string, err error)

func (*SFTP) Quit

func (s *SFTP) Quit() (err error)

func (*SFTP) RemoveDirectory

func (s *SFTP) RemoveDirectory(path string) (err error)

func (*SFTP) RenameFile

func (s *SFTP) RenameFile(from string, to string) (err error)

func (*SFTP) RetrieveFile

func (s *SFTP) RetrieveFile(remoteFilepath, localFilepath string) (err error)

func (*SFTP) RetrieveFileData

func (s *SFTP) RetrieveFileData(remoteFilepath string) (data []byte, err error)

func (*SFTP) StoreFile

func (s *SFTP) StoreFile(remoteFilepath string, data []byte) (err error)

Jump to

Keyboard shortcuts

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