feat: add ftp driver

This commit is contained in:
Noah Hsu
2022-09-03 22:07:08 +08:00
parent c89a462d0c
commit 849de88e68
8 changed files with 204 additions and 1 deletions

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

@ -0,0 +1,23 @@
package ftp
import "github.com/jlaffaye/ftp"
// do others that not defined in Driver interface
func (d *FTP) login() error {
if d.conn != nil {
_, err := d.conn.CurrentDir()
if err == nil {
return nil
}
}
conn, err := ftp.Dial(d.Address)
if err != nil {
return err
}
err = conn.Login(d.Username, d.Password)
if err != nil {
return err
}
return nil
}