Adds a public IP flag for ftp. Closes #3158

Fixed variable names
This commit is contained in:
calistri 2019-05-08 12:56:04 -04:00 committed by Nick Craig-Wood
parent 8beab1aaf2
commit f865280afa
3 changed files with 4 additions and 0 deletions

View File

@ -78,6 +78,7 @@ func newServer(f fs.Fs, opt *ftpopt.Options) (*server, error) {
}, },
Hostname: host, Hostname: host,
Port: portNum, Port: portNum,
PublicIp: opt.PublicIP,
PassivePorts: opt.PassivePorts, PassivePorts: opt.PassivePorts,
Auth: &Auth{ Auth: &Auth{
BasicUser: opt.BasicUser, BasicUser: opt.BasicUser,

View File

@ -16,6 +16,7 @@ var (
func AddFlagsPrefix(flagSet *pflag.FlagSet, prefix string, Opt *ftpopt.Options) { func AddFlagsPrefix(flagSet *pflag.FlagSet, prefix string, Opt *ftpopt.Options) {
rc.AddOption("ftp", &Opt) 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.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.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.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)") flags.StringVarP(flagSet, &Opt.BasicPass, prefix+"pass", "", Opt.BasicPass, "Password for authentication. (empty value allow every password)")

View File

@ -24,6 +24,7 @@ You can set a single username and password with the --user and --pass flags.
type Options struct { type Options struct {
//TODO add more options //TODO add more options
ListenAddr string // Port to listen on ListenAddr string // Port to listen on
PublicIP string // Passive ports range
PassivePorts string // Passive ports range PassivePorts string // Passive ports range
BasicUser string // single username for basic auth if not using Htpasswd BasicUser string // single username for basic auth if not using Htpasswd
BasicPass string // password for BasicUser BasicPass string // password for BasicUser
@ -32,6 +33,7 @@ type Options struct {
// DefaultOpt is the default values used for Options // DefaultOpt is the default values used for Options
var DefaultOpt = Options{ var DefaultOpt = Options{
ListenAddr: "localhost:2121", ListenAddr: "localhost:2121",
PublicIP: "",
PassivePorts: "30000-32000", PassivePorts: "30000-32000",
BasicUser: "anonymous", BasicUser: "anonymous",
BasicPass: "", BasicPass: "",