ftp

package
v1.0.10 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package ftp implement ftp protocol for file transfer

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrTokenPassword represent the password of token is wrong
	ErrTokenPassword = errors.New("toke password validate failed")

	// ErrAppPassword represent the password of app is wrong
	ErrAppPassword = errors.New("app password validate failed")

	// ErrTokenNotFound represent that wrong token is being used
	ErrTokenNotFound = errors.New("token not found")
)

Functions

This section is empty.

Types

type Auth

type Auth struct{}

Auth is used to implement ftp Auth interface

func (*Auth) CheckPasswd

func (a *Auth) CheckPasswd(name, password string) (correct bool, err error)

CheckPasswd is used to check the user whether is correct

type Driver

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

Driver is used to operate files

func (*Driver) ChangeDir

func (d *Driver) ChangeDir(path string) (err error)

ChangeDir is used to toggle current directory, if the directory doesn't exist, it will be created.

func (*Driver) DeleteDir

func (d *Driver) DeleteDir(path string) (err error)

DeleteDir is used to delete a directory

func (*Driver) DeleteFile

func (d *Driver) DeleteFile(path string) (err error)

DeleteFile is used to delete file by the path

func (*Driver) GetFile

func (d *Driver) GetFile(path string, offset int64) (size int64, rc io.ReadCloser, err error)

GetFile is used to download a file

func (*Driver) Init

func (d *Driver) Init(conn *server.Conn)

Init is a hook, when new connection coming, it will be called

func (*Driver) ListDir

func (d *Driver) ListDir(path string, callback func(server.FileInfo) error) (err error)

ListDir is used to list files and subDir of current dir

func (*Driver) MakeDir

func (d *Driver) MakeDir(path string) (err error)

MakeDir is used to create dir

func (*Driver) PutFile

func (d *Driver) PutFile(path string, dataConn io.Reader, append bool) (bytes int64, err error)

PutFile is used to upload file

func (*Driver) Rename

func (d *Driver) Rename(fromPath string, toPath string) (err error)

Rename is used to move file or rename file

func (*Driver) Stat

func (d *Driver) Stat(path string) (fileInfo server.FileInfo, err error)

Stat will return the information by the path

type Factory

type Factory struct{}

Factory is a driver factory, is used to generate driver when new connection comes

func (*Factory) NewDriver

func (factory *Factory) NewDriver() (server.Driver, error)

NewDriver return a driver

type FileInfo

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

FileInfo is used to represent the information of file or directory

func (*FileInfo) Group

func (f *FileInfo) Group() string

Group return the group of file

func (*FileInfo) IsDir

func (f *FileInfo) IsDir() bool

IsDir represent whether the object is a directory

func (*FileInfo) ModTime

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

ModTime is used to return the modify time of file

func (*FileInfo) Mode

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

Mode returns a file's mode and permission bits.

func (*FileInfo) Name

func (f *FileInfo) Name() string

Name return the name of file or directory

func (*FileInfo) Owner

func (f *FileInfo) Owner() string

Owner return the owner of file

func (*FileInfo) Size

func (f *FileInfo) Size() int64

Size return the size of file or directory

func (*FileInfo) Sys

func (f *FileInfo) Sys() interface{}

Sys always return nil

Jump to

Keyboard shortcuts

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