Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CommandDescription ¶
type CommandDescription struct { Open bool // Open to clients without auth. Fn func(*Handler) // Function to handle it. }
CommandDescription defines which function should be used and if it should be open to anyone or only logged in users.
type Context ¶
type Context interface { // Path provides the path of the current connection. Path() string }
Context is implemented on the server side to provide some access to few data around the client.
type Driver ¶
type Driver interface { // ChangeDirectory changes the current working directory. ChangeDirectory(cc Context, directory string) error // MakeDirectory creates a directory. MakeDirectory(cc Context, directory string) error // ListFiles lists the files of a directory. ListFiles(cc Context, dir string) ([]os.FileInfo, error) // OpenFile opens a file in 3 possible modes: read, write, appending write (use appropriate flags). OpenFile(cc Context, path string, flag int) (FileStream, error) // DeleteFile deletes a file or a directory. DeleteFile(cc Context, path string) error // GetFileInfo gets some info around a file or a directory. GetFileInfo(cc Context, path string) (os.FileInfo, error) // RenameFile renames a file or a directory. RenameFile(cc Context, from, to string) error // CanAllocate gives the approval to allocate some data. CanAllocate(cc Context, size int) (bool, error) // ChmodFile changes the attributes of the file. ChmodFile(cc Context, path string, mode os.FileMode) error }
Driver handles the file system access logic.
type FileStream ¶
FileStream is a read or write closeable stream.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler driver handles the file system access logic.
func NewHandler ¶
NewHandler initializes a client handler when someone connects.
func (*Handler) HandleCommands ¶
func (c *Handler) HandleCommands()
HandleCommands reads the stream of commands.
func (*Handler) TransferClose ¶
func (c *Handler) TransferClose()
TransferClose closes transfer with handler
func (*Handler) TransferOpen ¶
TransferOpen opens transfer with handler
func (*Handler) WriteMessage ¶
WriteMessage writes server response
Click to show internal directories.
Click to hide internal directories.