Versions in this module Expand all Collapse all v0 v0.1.2 Jun 26, 2022 v0.1.1 Jun 7, 2022 v0.1.0 May 30, 2022 Changes in this version + var ErrServerClosed = errors.New("ftp: Server closed") + func Version() string + type Auth interface + CheckPasswd func(string, string) (bool, error) + type Command interface + Execute func(*Conn, string) + IsExtend func() bool + RequireAuth func() bool + RequireParam func() bool + type Conn struct + func (conn *Conn) Close() + func (conn *Conn) IsLogin() bool + func (conn *Conn) LoginUser() string + func (conn *Conn) PassivePort() int + func (conn *Conn) PublicIP() string + func (conn *Conn) RemoteAddr() net.Addr + func (conn *Conn) Serve() + func (conn *Conn) ServerOpts() *ServerOpts + type DataSocket interface + Close func() error + Host func() string + Port func() int + Read func(p []byte) (n int, err error) + ReadFrom func(r io.Reader) (int64, error) + Write func(p []byte) (n int, err error) + type DiscardLogger struct + func (logger *DiscardLogger) Print(sessionID string, message interface{}) + func (logger *DiscardLogger) PrintCommand(sessionID string, command string, params string) + func (logger *DiscardLogger) PrintResponse(sessionID string, code int, message string) + func (logger *DiscardLogger) Printf(sessionID string, format string, v ...interface{}) + type Driver interface + DeleteDir func(string) error + DeleteFile func(string) error + GetFile func(string, int64) (int64, io.ReadCloser, error) + ListDir func(string, func(FileInfo) error) error + MakeDir func(string) error + PutFile func(string, io.Reader, bool) (int64, error) + Rename func(string, string) error + Stat func(string) (FileInfo, error) + type DriverFactory interface + NewDriver func() (Driver, error) + type FileInfo interface + Group func() string + Owner func() string + type Logger interface + Print func(sessionID string, message interface{}) + PrintCommand func(sessionID string, command string, params string) + PrintResponse func(sessionID string, code int, message string) + Printf func(sessionID string, format string, v ...interface{}) + type MultipleDriver struct + func (driver *MultipleDriver) DeleteDir(path string) error + func (driver *MultipleDriver) DeleteFile(path string) error + func (driver *MultipleDriver) GetFile(path string, offset int64) (int64, io.ReadCloser, error) + func (driver *MultipleDriver) ListDir(path string, callback func(FileInfo) error) error + func (driver *MultipleDriver) MakeDir(path string) error + func (driver *MultipleDriver) PutFile(destPath string, data io.Reader, appendData bool) (int64, error) + func (driver *MultipleDriver) Rename(fromPath string, toPath string) error + func (driver *MultipleDriver) Stat(path string) (FileInfo, error) + type MultipleDriverFactory struct + func (factory *MultipleDriverFactory) NewDriver() (Driver, error) + type Notifier interface + AfterCurDirChanged func(conn *Conn, oldCurDir, newCurDir string, err error) + AfterDirCreated func(conn *Conn, dstPath string, err error) + AfterDirDeleted func(conn *Conn, dstPath string, err error) + AfterFileDeleted func(conn *Conn, dstPath string, err error) + AfterFileDownloaded func(conn *Conn, dstPath string, size int64, err error) + AfterFilePut func(conn *Conn, dstPath string, size int64, err error) + AfterUserLogin func(conn *Conn, userName, password string, passMatched bool, err error) + BeforeChangeCurDir func(conn *Conn, oldCurDir, newCurDir string) + BeforeCreateDir func(conn *Conn, dstPath string) + BeforeDeleteDir func(conn *Conn, dstPath string) + BeforeDeleteFile func(conn *Conn, dstPath string) + BeforeDownloadFile func(conn *Conn, dstPath string) + BeforeLoginUser func(conn *Conn, userName string) + BeforePutFile func(conn *Conn, dstPath string) + type NullNotifier struct + func (NullNotifier) AfterCurDirChanged(conn *Conn, oldCurDir, newCurDir string, err error) + func (NullNotifier) AfterDirCreated(conn *Conn, dstPath string, err error) + func (NullNotifier) AfterDirDeleted(conn *Conn, dstPath string, err error) + func (NullNotifier) AfterFileDeleted(conn *Conn, dstPath string, err error) + func (NullNotifier) AfterFileDownloaded(conn *Conn, dstPath string, size int64, err error) + func (NullNotifier) AfterFilePut(conn *Conn, dstPath string, size int64, err error) + func (NullNotifier) AfterUserLogin(conn *Conn, userName, password string, passMatched bool, err error) + func (NullNotifier) BeforeChangeCurDir(conn *Conn, oldCurDir, newCurDir string) + func (NullNotifier) BeforeCreateDir(conn *Conn, dstPath string) + func (NullNotifier) BeforeDeleteDir(conn *Conn, dstPath string) + func (NullNotifier) BeforeDeleteFile(conn *Conn, dstPath string) + func (NullNotifier) BeforeDownloadFile(conn *Conn, dstPath string) + func (NullNotifier) BeforeLoginUser(conn *Conn, userName string) + func (NullNotifier) BeforePutFile(conn *Conn, dstPath string) + type Perm interface + ChGroup func(string, string) error + ChMode func(string, os.FileMode) error + ChOwner func(string, string) error + GetGroup func(string) (string, error) + GetMode func(string) (os.FileMode, error) + GetOwner func(string) (string, error) + type Server struct + func NewServer(opts *ServerOpts) *Server + func (server *Server) ListenAndServe() error + func (server *Server) RegisterNotifer(notifier Notifier) + func (server *Server) Serve(l net.Listener) error + func (server *Server) Shutdown() error + type ServerOpts struct + Auth Auth + CertFile string + ExplicitFTPS bool + Factory DriverFactory + ForceTLS bool + Hostname string + KeyFile string + Logger Logger + Name string + PassivePorts string + Port int + PublicIP string + TLS bool + WelcomeMessage string + type SimpleAuth struct + Name string + Password string + func (a *SimpleAuth) CheckPasswd(name, pass string) (bool, error) + type SimplePerm struct + func NewSimplePerm(owner, group string) *SimplePerm + func (s *SimplePerm) ChGroup(string, string) error + func (s *SimplePerm) ChMode(string, os.FileMode) error + func (s *SimplePerm) ChOwner(string, string) error + func (s *SimplePerm) GetGroup(string) (string, error) + func (s *SimplePerm) GetMode(string) (os.FileMode, error) + func (s *SimplePerm) GetOwner(string) (string, error) + type StdLogger struct + func (logger *StdLogger) Print(sessionID string, message interface{}) + func (logger *StdLogger) PrintCommand(sessionID string, command string, params string) + func (logger *StdLogger) PrintResponse(sessionID string, code int, message string) + func (logger *StdLogger) Printf(sessionID string, format string, v ...interface{})