ftpfs

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package ftpfs handle connections and operations to deal with an FTP server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BackupCommand

type BackupCommand struct {
	Server RemoteServer
	AppFs  afero.Fs
	Name   string
	DryRun bool
}

BackupCommand implements the backup request.

type Client

type Client struct {
	Command Command
}

Client is the sturct representing the invoker, who is responsible for initiating requests.

func BackupAction

func BackupAction(conn *FTPServerConnection, appFs afero.Fs, name string, dryRun bool) *Client

BackupAction creates and configures the concrete backup command.

func DeleteAllAction

func DeleteAllAction(conn *FTPServerConnection, exludeList []string, dryRun bool) *Client

DeleteAllAction creates and configures the concrete delete all command.

func DialAction

func DialAction(conn *FTPServerConnection) *Client

DialAction creates and configures the concrete dial command.

func IdleAction

func IdleAction(conn *FTPServerConnection) *Client

IdleAction creates and configures the concrete no-operation(idle) command.

func LoginAction

func LoginAction(conn *FTPServerConnection) *Client

LoginAction creates and configures the concrete login command.

func LogoutAction

func LogoutAction(conn *FTPServerConnection) *Client

LogoutAction creates and configures the concrete logout command.

func MakeDirsAction

func MakeDirsAction(conn *FTPServerConnection, dirs []string, dryRun bool) *Client

MakeDirsAction creates and configures the concrete dial command.

func UploadAction

func UploadAction(conn *FTPServerConnection, appFs afero.Fs, localDirname string, files []string, replaceBasePath, dryRun bool) *Client

UploadAction creates and configures the concrete upload command.

func (*Client) Run

func (c *Client) Run() error

Run execute the method on a receiving object.

type Command

type Command interface {
	// contains filtered or unexported methods
}

Command interface declares just the single method for executing the command.

type DeleteAllCommand

type DeleteAllCommand struct {
	Server      RemoteServer
	ExcludeList []string
	DryRun      bool
}

DeleteAllCommand implements the delete all request.

type DialCommand

type DialCommand struct {
	Server RemoteServer
}

DialCommand implements the dial request.

type FTPConnectionConfig

type FTPConnectionConfig struct {
	Host     string
	Port     int
	User     string
	Password string
	Timeout  int
	IsEPSV   bool
}

FTPConnectionConfig is the struct with all is needed to establish an FTP connection to a remote server.

type FTPServerConnection

type FTPServerConnection struct {
	Config FTPConnectionConfig
	// contains filtered or unexported fields
}

FTPServerConnection is the struct with all is needed to establish and act on the FTP remote server.

func NewFTPServerConnection

func NewFTPServerConnection(config *FTPConnectionConfig) *FTPServerConnection

NewFTPServerConnection returns a new FTPServerConnection struct.

func (*FTPServerConnection) DeleteAll

func (s *FTPServerConnection) DeleteAll(exclude []string, dryrun bool) error

DeleteAll contains the logic for the FTP receiver to handle the delete all command.

func (*FTPServerConnection) Dial

func (s *FTPServerConnection) Dial() error

Dial contains the logic for the FTP receiver to handle the dial command.

func (*FTPServerConnection) DoBackup

func (s *FTPServerConnection) DoBackup(appFs afero.Fs, tarballFilePath string, dryRun bool) error

DoBackup contains the logic for the FTP receiver to handle the backup command.

func (*FTPServerConnection) Idle

func (s *FTPServerConnection) Idle() error

Idle contains the logic for the FTP receiver to handle the no-operation (idle) command.

func (*FTPServerConnection) Login

func (s *FTPServerConnection) Login() error

Login contains the logic for the FTP receiver to handle the login command.

func (*FTPServerConnection) Logout

func (s *FTPServerConnection) Logout() error

Logout contains the logic for the FTP receiver to handle the logout command.

func (*FTPServerConnection) MakeDirs

func (s *FTPServerConnection) MakeDirs(folders []string, dryRun bool) error

MakeDirs contains the logic for the FTP receiver to handle the make dirs command.

func (*FTPServerConnection) SetLogger added in v0.11.0

func (s *FTPServerConnection) SetLogger(logger *yinlog.Logger)

SetLogger sets the root folder on the FTP remote server.

func (*FTPServerConnection) SetRootFolder

func (s *FTPServerConnection) SetRootFolder(name string)

SetRootFolder sets the root folder on the FTP remote server.

func (*FTPServerConnection) UploadFiles added in v0.11.0

func (s *FTPServerConnection) UploadFiles(appFs afero.Fs, localDir string, files []string, replaceBasePath, dryRun bool) error

UploadFiles contains the logic for the FTP receiver to handle the upload files command.

type IdleCommand

type IdleCommand struct {
	Server RemoteServer
}

IdleCommand implements the no-operation (idle) request.

type LoginCommand

type LoginCommand struct {
	Server RemoteServer
}

LoginCommand implements the login request.

type LogoutCommand

type LogoutCommand struct {
	Server RemoteServer
}

LogoutCommand implements the logout request.

type MakeDirsCommand

type MakeDirsCommand struct {
	Server  RemoteServer
	Dirs    []string
	DryRun  bool
	Verbose bool
}

MakeDirsCommand implements the make dirs request.

type RemoteServer

type RemoteServer interface {
	Dial() error
	Login() error
	Logout() error
	Idle() error
	MakeDirs([]string, bool) error
	UploadFiles(afero.Fs, string, []string, bool, bool) error
	DeleteAll([]string, bool) error
	DoBackup(afero.Fs, string, bool) error
}

RemoteServer is the interface defining the list of actions can be performed on a RemoteServer implementation.

type UploadCommand

type UploadCommand struct {
	Server          RemoteServer
	AppFs           afero.Fs
	LocalDirname    string
	Files           []string
	ReplaceBasePath bool
	DryRun          bool
	Verbose         bool
}

UploadCommand implements the upload request.

Jump to

Keyboard shortcuts

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