Documentation ¶
Index ¶
- Variables
- func AddFlags(flagSet *pflag.FlagSet)
- type Driver
- func (d *Driver) ChangeDir(path string) (err error)
- func (d *Driver) CheckPasswd(user, pass string) (ok bool, err error)
- func (d *Driver) DeleteDir(path string) (err error)
- func (d *Driver) DeleteFile(path string) (err error)
- func (d *Driver) GetFile(path string, offset int64) (size int64, fr io.ReadCloser, err error)
- func (d *Driver) ListDir(path string, callback func(ftp.FileInfo) error) (err error)
- func (d *Driver) MakeDir(path string) (err error)
- func (d *Driver) PutFile(path string, data io.Reader, appendData bool) (n int64, err error)
- func (d *Driver) Rename(oldName, newName string) (err error)
- func (d *Driver) Stat(path string) (fi ftp.FileInfo, err error)
- type FileInfo
- type Logger
- type Options
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. ### Server options Use --addr to specify which IP address and port the server should listen on, e.g. --addr 1.2.3.4:8000 or --addr :8080 to listen to all IPs. By default it only listens on localhost. You can use port :0 to let the OS choose an available port. If you set --addr to listen on a public or LAN accessible IP address then using Authentication is advised - see the next section for info. #### Authentication By default this will serve files without needing a login. You can set a single username and password with the --user and --pass flags. ` + 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(context.Background(), f, &Opt) if err != nil { return err } return s.serve() }) }, }
Command definition for cobra
View Source
var DefaultOpt = Options{
ListenAddr: "localhost:2121",
PublicIP: "",
PassivePorts: "30000-32000",
BasicUser: "anonymous",
BasicPass: "",
}
DefaultOpt is the default values used for Options
View Source
var Opt = DefaultOpt
Opt is options set by command line flags
Functions ¶
Types ¶
type Driver ¶
type Driver struct {
// contains filtered or unexported fields
}
Driver implementation of ftp server
func (*Driver) CheckPasswd ¶ added in v1.50.20
CheckPasswd handle auth based on configuration
func (*Driver) DeleteFile ¶
DeleteFile delete a file
type FileInfo ¶
FileInfo struct to hold file info for ftp server
type Logger ¶
type Logger struct{}
Logger ftp logger output formatted message
func (*Logger) PrintCommand ¶
PrintCommand log formatted command execution
func (*Logger) PrintResponse ¶
PrintResponse log responses
type Options ¶ added in v1.6.1
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 TLSCert string // TLS PEM key (concatenation of certificate and CA certificate) TLSKey string // TLS PEM Private key }
Options contains options for the http Server
Click to show internal directories.
Click to hide internal directories.