ftp support

This commit is contained in:
微凉
2021-12-16 18:03:58 +08:00
parent 92a0453e00
commit d49f92b542
9 changed files with 294 additions and 7 deletions

23
drivers/ftp/ftp.go Normal file
View File

@ -0,0 +1,23 @@
package ftp
import (
"github.com/Xhofe/alist/drivers/base"
"github.com/Xhofe/alist/model"
"github.com/jlaffaye/ftp"
)
func (driver FTP) Login(account *model.Account) (*ftp.ServerConn, error) {
conn, err := ftp.Connect(account.SiteUrl)
if err != nil {
return nil, err
}
err = conn.Login(account.Username, account.Password)
if err != nil {
return nil, err
}
return conn, nil
}
func init() {
base.RegisterDriver(&FTP{})
}