Documentation ¶
Index ¶
- func NewTestServer(debug bool) *server.FtpServer
- func NewTestServerWithDriver(driver *ServerDriver) *server.FtpServer
- type ClientDriver
- func (driver *ClientDriver) CanAllocate(cc server.ClientContext, size int) (bool, error)
- func (driver *ClientDriver) ChangeDirectory(cc server.ClientContext, directory string) error
- func (driver *ClientDriver) ChmodFile(cc server.ClientContext, path string, mode os.FileMode) error
- func (driver *ClientDriver) DeleteFile(cc server.ClientContext, path string) error
- func (driver *ClientDriver) GetFileInfo(cc server.ClientContext, path string) (os.FileInfo, error)
- func (driver *ClientDriver) ListFiles(cc server.ClientContext) ([]os.FileInfo, error)
- func (driver *ClientDriver) MakeDirectory(cc server.ClientContext, directory string) error
- func (driver *ClientDriver) OpenFile(cc server.ClientContext, path string, flag int) (server.FileStream, error)
- func (driver *ClientDriver) RenameFile(cc server.ClientContext, from, to string) error
- type ServerDriver
- func (driver *ServerDriver) AuthUser(cc server.ClientContext, user, pass string) (server.ClientHandlingDriver, error)
- func (driver *ServerDriver) GetSettings() (*server.Settings, error)
- func (driver *ServerDriver) GetTLSConfig() (*tls.Config, error)
- func (driver *ServerDriver) UserLeft(cc server.ClientContext)
- func (driver *ServerDriver) WelcomeUser(cc server.ClientContext) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewTestServer ¶
NewTestServer provides a test server with or without debugging
func NewTestServerWithDriver ¶
func NewTestServerWithDriver(driver *ServerDriver) *server.FtpServer
NewTestServerWithDriver provides a server instantiated with some settings
Types ¶
type ClientDriver ¶
type ClientDriver struct { server.FileStream // contains filtered or unexported fields }
ClientDriver defines a minimal serverftp client driver
func (*ClientDriver) CanAllocate ¶
func (driver *ClientDriver) CanAllocate(cc server.ClientContext, size int) (bool, error)
CanAllocate gives the approval to allocate some data
func (*ClientDriver) ChangeDirectory ¶
func (driver *ClientDriver) ChangeDirectory(cc server.ClientContext, directory string) error
ChangeDirectory changes the current working directory
func (*ClientDriver) ChmodFile ¶
func (driver *ClientDriver) ChmodFile(cc server.ClientContext, path string, mode os.FileMode) error
ChmodFile changes the attributes of the file
func (*ClientDriver) DeleteFile ¶
func (driver *ClientDriver) DeleteFile(cc server.ClientContext, path string) error
DeleteFile deletes a file or a directory
func (*ClientDriver) GetFileInfo ¶
func (driver *ClientDriver) GetFileInfo(cc server.ClientContext, path string) (os.FileInfo, error)
GetFileInfo gets some info around a file or a directory
func (*ClientDriver) ListFiles ¶
func (driver *ClientDriver) ListFiles(cc server.ClientContext) ([]os.FileInfo, error)
ListFiles lists the files of a directory
func (*ClientDriver) MakeDirectory ¶
func (driver *ClientDriver) MakeDirectory(cc server.ClientContext, directory string) error
MakeDirectory creates a directory
func (*ClientDriver) OpenFile ¶
func (driver *ClientDriver) OpenFile(cc server.ClientContext, path string, flag int) (server.FileStream, error)
OpenFile opens a file in 3 possible modes: read, write, appending write (use appropriate flags)
func (*ClientDriver) RenameFile ¶
func (driver *ClientDriver) RenameFile(cc server.ClientContext, from, to string) error
RenameFile renames a file or a directory
type ServerDriver ¶
type ServerDriver struct { Debug bool // To display connection logs information TLS bool Settings *server.Settings // Settings server.FileStream }
ServerDriver defines a minimal serverftp server driver
func (*ServerDriver) AuthUser ¶
func (driver *ServerDriver) AuthUser(cc server.ClientContext, user, pass string) (server.ClientHandlingDriver, error)
AuthUser with authenticate users
func (*ServerDriver) GetSettings ¶
func (driver *ServerDriver) GetSettings() (*server.Settings, error)
GetSettings fetches the basic server settings
func (*ServerDriver) GetTLSConfig ¶
func (driver *ServerDriver) GetTLSConfig() (*tls.Config, error)
GetTLSConfig fetches the TLS config
func (*ServerDriver) UserLeft ¶
func (driver *ServerDriver) UserLeft(cc server.ClientContext)
UserLeft is called when the user disconnects
func (*ServerDriver) WelcomeUser ¶
func (driver *ServerDriver) WelcomeUser(cc server.ClientContext) (string, error)
WelcomeUser is the very first message people will see