Documentation ¶
Index ¶
- Constants
- type ErrorHandlerFunc
- type FTP
- func (ftp *FTP) AuthTLS(config *tls.Config) error
- func (ftp *FTP) Close()
- func (ftp *FTP) Cwd(path string) (err error)
- func (ftp *FTP) Dele(path string) (err error)
- func (ftp *FTP) GetFilesList(path string) (files []string, directories []string, links []string, err error)
- func (ftp *FTP) HasCode(line string, code int) bool
- func (ftp *FTP) List(path string) (files []string, err error)
- func (ftp *FTP) Login(username string, password string) (err error)
- func (ftp *FTP) Mkd(path string) error
- func (ftp *FTP) NewPassiveConnection() (conn net.Conn, err error)
- func (ftp *FTP) Noop() (err error)
- func (ftp *FTP) Pasv() (port int, err error)
- func (ftp *FTP) Pwd() (path string, err error)
- func (ftp *FTP) Quit() (err error)
- func (ftp *FTP) RawCmd(command string, args ...interface{}) (code int, line string)
- func (ftp *FTP) RawPassiveCmd(command string) (code int, response []string)
- func (ftp *FTP) Rename(from string, to string) (err error)
- func (ftp *FTP) Retr(path string, retrFn RetrFunc) (s string, err error)
- func (ftp *FTP) Stor(path string, r io.Reader) (err error)
- func (ftp *FTP) Type(t TransferMode) error
- func (ftp *FTP) Walk(path string, walkFn WalkFunc, deepLimit ...int) (err error)
- func (ftp *FTP) WalkCustom(path string, walkFn WalkFunc, errHandler ErrorHandlerFunc, deepLimit ...int) (err error)
- type RetrFunc
- type TransferMode
- type WalkFunc
Constants ¶
const ( //MLSD server can return directory listing in machine readable format. //Supported MLSD = 1 //NLST server can return a list of filenames in the given directory, with no other information. //Not supported NLST = 2 //EPLF server can return directory listing in "Easily Parsed LIST Format" //Not supported EPLF = 4 //BAD this server only supports LIST output format BAD = 1 >> 32 //ModeASCII transfer mode ASCII ModeASCII TransferMode = "A" //ModeBinary transfer mode binary ModeBinary TransferMode = "I" )
const ( CodeRestartMarker = 110 CodeServiceReadyNNNminutes = 120 CodeDataConnectionAlreadyOpen = 125 CodeFileStatusOk = 150 CodeCommandOk = 200 CodeCommandNotImplementedInfo = 202 CodeSystemStatus = 211 CodeDirectoryStatus = 212 CodeFileStatus = 213 CodeHelpMessage = 214 CodeSystemType = 215 CodeServiceReadyForNewUser = 220 CodeServiceClosingControlConnection = 221 CodeDataConnectionOpenNoTransferInProgress = 225 CodeClosingDataConnection = 226 CodeEnteringPassiveMode = 227 CodeEnteringLongPassiveMode = 228 CodeEnteringExtendedPassiveMode = 229 CodeUserLoggedIn = 230 CodeUserLoggedOut = 231 CodeLogoutNoted = 232 CodeAuthMechanismAccepted = 234 CodeRequestedFileActionOk = 250 CodePathnameCreated = 257 CodeUserNameOkNeedPassword = 331 CodeNeedAccountForLogin = 332 CodeRequestedFileActionPending = 350 CodeServiceNotAvaliable = 421 CodeCantOpenDataConnection = 425 CodeConnectionClosed = 426 CodeInvalidUsernameOrPassword = 430 CodeRequestedFileActionNotTaken = 450 CodeRequestedActionAborted = 451 CodeRequestedActionNotTaken = 452 CodeSyntaxError = 501 CodeCommandNotImplementedError = 502 CodeBadSequenceOfCommandsError = 503 CodeCommandNotImplementedForParamError = 504 CodeNotLoggedInError = 530 CodeNeedAccountForStoringError = 532 CodePageTypeunknownError = 551 CodeExceededStorageAllocationError = 552 CodeFileNameNotAllowedError = 553 CodeIntegrityProtectedReply = 631 CodeConfidentialityAndIntegrityProtectedReply = 632 CodeConfidentialityProtectedReply = 633 )
FTP status codes https://en.wikipedia.org/wiki/List_of_FTP_server_return_codes
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ErrorHandlerFunc ¶
type ErrorHandlerFunc func(pwd string, errorCode int, errorStr string, shouldBeSkippable bool) (skippable bool, err error)
ErrorHandlerFunc is the type of the function called on error in FTP.WalkCustom
type FTP ¶
type FTP struct {
// contains filtered or unexported fields
}
FTP is ftp client
func ConnectDbg ¶
ConnectDbg connect to server, debug is ON
func (*FTP) GetFilesList ¶
func (ftp *FTP) GetFilesList(path string) (files []string, directories []string, links []string, err error)
GetFilesList list the path (or current directory) and parse it. Return an array with the files, one with the directories and one with the links
func (*FTP) NewPassiveConnection ¶
NewPassiveConnection enables passive data connection and connect to server
func (*FTP) RawPassiveCmd ¶
RawPassiveCmd open a passive connection with pasv, send a raw command, retrieve the response, close the connection, return the response
func (*FTP) Type ¶
func (ftp *FTP) Type(t TransferMode) error
Type sets the transfer mode (ASCII/Binary).
func (*FTP) Walk ¶
Walk walks recursively through path and call walkfunc for each file. - links are ignored. - the optional parameter deepLimit controls the max level of recursion. - recursion stops on first error , *always*. - Directories are traversed in pre-order
func (*FTP) WalkCustom ¶
func (ftp *FTP) WalkCustom(path string, walkFn WalkFunc, errHandler ErrorHandlerFunc, deepLimit ...int) (err error)
WalkCustom walks recursively through path and call walkFunc for each file. - links are ignored. - the optional parameter deepLimit controls the max level of recursion. - recursion stops only if errHandler returns false ( or if it's not defined ) - Directories are traversed in pre-order