tests

package
v0.0.0-...-9df619b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 7, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTestServer

func NewTestServer(debug bool) *server.FtpServer

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 NewClientDriver

func NewClientDriver() *ClientDriver

NewClientDriver creates a 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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL