rclone: github.com/ncw/rclone/cmd/serve/ftp Index | Files

package ftp

import "github.com/ncw/rclone/cmd/serve/ftp"

Index

Package Files

ftp.go

Variables

var Command = &cobra.Command{
    Use:   "ftp remote:path",
    Short: `Serve remote:path over FTP.`,
    Long: "" /* 745 byte string literal not displayed */+
        vfs.Help + proxy.Help,
    Run: func(command *cobra.Command, args []string) {
        var f fs.Fs
        if proxyflags.Opt.AuthProxy == "" {
            cmd.CheckArgs(1, 1, command, args)
            f = cmd.NewFsSrc(args)
        } else {
            cmd.CheckArgs(0, 0, command, args)
        }
        cmd.Run(false, false, command, func() error {
            s, err := newServer(f, &Opt)
            if err != nil {
                return err
            }
            return s.serve()
        })
    },
}

Command definition for cobra

var DefaultOpt = Options{
    ListenAddr:   "localhost:2121",
    PublicIP:     "",
    PassivePorts: "30000-32000",
    BasicUser:    "anonymous",
    BasicPass:    "",
}

DefaultOpt is the default values used for Options

var Opt = DefaultOpt

Opt is options set by command line flags

func AddFlags Uses

func AddFlags(flagSet *pflag.FlagSet)

AddFlags adds flags for ftp

type Driver Uses

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

Driver implementation of ftp server

func (*Driver) ChangeDir Uses

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

ChangeDir move current folder

func (*Driver) DeleteDir Uses

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

DeleteDir delete a folder and his content

func (*Driver) DeleteFile Uses

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

DeleteFile delete a file

func (*Driver) GetFile Uses

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

GetFile download a file

func (*Driver) Init Uses

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

Init a connection

func (*Driver) ListDir Uses

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

ListDir list content of a folder

func (*Driver) MakeDir Uses

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

MakeDir create a folder

func (*Driver) PutFile Uses

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

PutFile upload a file

func (*Driver) Rename Uses

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

Rename rename a file or folder

func (*Driver) Stat Uses

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

Stat get information on file or folder

type FileInfo Uses

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

FileInfo struct to hold file info for ftp server

func (*FileInfo) Group Uses

func (f *FileInfo) Group() string

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

func (*FileInfo) Mode Uses

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

Mode return mode of file.

func (*FileInfo) Owner Uses

func (f *FileInfo) Owner() string

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

type Logger Uses

type Logger struct{}

Logger ftp logger output formatted message

func (*Logger) Print Uses

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

Print log simple text message

func (*Logger) PrintCommand Uses

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

PrintCommand log formatted command execution

func (*Logger) PrintResponse Uses

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

PrintResponse log responses

func (*Logger) Printf Uses

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

Printf log formatted text message

type Options Uses

type Options struct {
    //TODO add more options
    ListenAddr   string // Port to listen on
    PublicIP     string // Passive ports range
    PassivePorts string // Passive ports range
    BasicUser    string // single username for basic auth if not using Htpasswd
    BasicPass    string // password for BasicUser
}

Options contains options for the http Server

Package ftp imports 23 packages (graph) and is imported by 2 packages. Updated 2019-08-09. Refresh now. Tools for package owners.