diff --git a/cmd/serve/ftp/ftp.go b/cmd/serve/ftp/ftp.go index ea870c890..4f836bcd9 100644 --- a/cmd/serve/ftp/ftp.go +++ b/cmd/serve/ftp/ftp.go @@ -78,6 +78,7 @@ func newServer(f fs.Fs, opt *ftpopt.Options) (*server, error) { }, Hostname: host, Port: portNum, + PublicIp: opt.PublicIP, PassivePorts: opt.PassivePorts, Auth: &Auth{ BasicUser: opt.BasicUser, diff --git a/cmd/serve/ftp/ftpflags/ftpflags.go b/cmd/serve/ftp/ftpflags/ftpflags.go index 5cb227600..65b5ead6a 100644 --- a/cmd/serve/ftp/ftpflags/ftpflags.go +++ b/cmd/serve/ftp/ftpflags/ftpflags.go @@ -16,6 +16,7 @@ var ( func AddFlagsPrefix(flagSet *pflag.FlagSet, prefix string, Opt *ftpopt.Options) { rc.AddOption("ftp", &Opt) flags.StringVarP(flagSet, &Opt.ListenAddr, prefix+"addr", "", Opt.ListenAddr, "IPaddress:Port or :Port to bind server to.") + flags.StringVarP(flagSet, &Opt.PublicIP, prefix+"public-ip", "", Opt.PublicIP, "Public IP address to advertise for passive connections.") flags.StringVarP(flagSet, &Opt.PassivePorts, prefix+"passive-port", "", Opt.PassivePorts, "Passive port range to use.") flags.StringVarP(flagSet, &Opt.BasicUser, prefix+"user", "", Opt.BasicUser, "User name for authentication.") flags.StringVarP(flagSet, &Opt.BasicPass, prefix+"pass", "", Opt.BasicPass, "Password for authentication. (empty value allow every password)") diff --git a/cmd/serve/ftp/ftpopt/ftp_options.go b/cmd/serve/ftp/ftpopt/ftp_options.go index 11495bd98..4101a64ec 100644 --- a/cmd/serve/ftp/ftpopt/ftp_options.go +++ b/cmd/serve/ftp/ftpopt/ftp_options.go @@ -24,6 +24,7 @@ You can set a single username and password with the --user and --pass flags. 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 @@ -32,6 +33,7 @@ type Options struct { // DefaultOpt is the default values used for Options var DefaultOpt = Options{ ListenAddr: "localhost:2121", + PublicIP: "", PassivePorts: "30000-32000", BasicUser: "anonymous", BasicPass: "",