ftp

package
v1.48.1 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2019 License: MIT Imports: 18 Imported by: ? 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

This section is empty.

Variables

View Source
var Command = &cobra.Command{
	Use:   "ftp remote:path",
	Short: `Serve remote:path over FTP.`,
	Long: `
rclone serve ftp implements a basic ftp server to serve the
remote over FTP protocol. This can be viewed with a ftp client
or you can make a remote of type ftp to read and write it.
` + ftpopt.Help + vfs.Help,
	Run: func(command *cobra.Command, args []string) {
		cmd.CheckArgs(1, 1, command, args)
		f := cmd.NewFsSrc(args)
		cmd.Run(false, false, command, func() error {
			s, err := newServer(f, &ftpflags.Opt)
			if err != nil {
				return err
			}
			return s.serve()
		})
	},
}

Command definition for cobra

Functions

This section is empty.

Types

type Auth

type Auth struct {
	BasicUser string
	BasicPass string
}

Auth struct to handle ftp auth (temporary simple for POC)

func (*Auth) CheckPasswd

func (a *Auth) CheckPasswd(user, pass string) (bool, error)

CheckPasswd handle auth based on configuration

type Driver

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

Driver implementation of ftp server

func (*Driver) ChangeDir

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

ChangeDir move current folder

func (*Driver) DeleteDir

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

DeleteDir delete a folder and his content

func (*Driver) DeleteFile

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

DeleteFile delete a file

func (*Driver) GetFile

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

GetFile download a file

func (*Driver) Init

func (d *Driver) Init(*ftp.Conn)

Init a connection

func (*Driver) ListDir

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

ListDir list content of a folder

func (*Driver) MakeDir

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

MakeDir create a folder

func (*Driver) PutFile

func (d *Driver) PutFile(path string, data io.Reader, appendData bool) (n int64, err error)

PutFile upload a file

func (*Driver) Rename

func (d *Driver) Rename(oldName, newName string) (err error)

Rename rename a file or folder

func (*Driver) Stat

func (d *Driver) Stat(path string) (fi ftp.FileInfo, err error)

Stat get information on file or folder

type DriverFactory

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

DriverFactory factory of ftp driver for each session

func (*DriverFactory) NewDriver

func (f *DriverFactory) NewDriver() (ftp.Driver, error)

NewDriver start a new session

type FileInfo

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

FileInfo struct to hold file info for ftp server

func (*FileInfo) Group

func (f *FileInfo) Group() string

Group return group of file. Try to find the group name if possible

func (*FileInfo) Mode

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

Mode return mode of file.

func (*FileInfo) Owner

func (f *FileInfo) Owner() string

Owner return owner of file. Try to find the username if possible

type Logger

type Logger struct{}

Logger ftp logger output formatted message

func (*Logger) Print

func (l *Logger) Print(sessionID string, message interface{})

Print log simple text message

func (*Logger) PrintCommand

func (l *Logger) PrintCommand(sessionID string, command string, params string)

PrintCommand log formatted command execution

func (*Logger) PrintResponse

func (l *Logger) PrintResponse(sessionID string, code int, message string)

PrintResponse log responses

func (*Logger) Printf

func (l *Logger) Printf(sessionID string, format string, v ...interface{})

Printf log formatted text message

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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