Documentation ¶
Overview ¶
Package goftp upload helper
Index ¶
- Constants
- Variables
- func StatusText(code string) string
- type FTP
- func (ftp *FTP) AuthTLS(config *tls.Config) error
- func (ftp *FTP) Close() error
- func (ftp *FTP) Cwd(path string) (err error)
- func (ftp *FTP) Dele(path string) (err error)
- 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) 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) ReadAndDiscard() (int, error)
- 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) Rmd(path string) (err error)
- func (ftp *FTP) Size(path string) (size int, err error)
- func (ftp *FTP) Stat(path string) ([]string, error)
- func (ftp *FTP) Stor(path string, r io.Reader) (err error)
- func (ftp *FTP) Syst() (line string, err error)
- func (ftp *FTP) Type(t TypeCode) error
- func (ftp *FTP) Upload(localPath string) (err error)
- func (ftp *FTP) Walk(path string, walkFn WalkFunc) (err error)
- type RetrFunc
- type TypeCode
- type WalkFunc
Constants ¶
const ( // TypeASCII for ASCII TypeASCII = "A" // TypeEBCDIC for EBCDIC TypeEBCDIC = "E" // TypeImage for an Image TypeImage = "I" // TypeLocal for local byte size TypeLocal = "L" )
const ( StatusFileOK = "150" StatusOK = "200" StatusSystemStatus = "211" StatusDirectoryStatus = "212" StatusFileStatus = "213" StatusConnectionClosing = "221" StatusSystemType = "215" StatusClosingDataConnection = "226" StatusActionOK = "250" StatusPathCreated = "257" StatusActionPending = "350" )
FTP Status codes, defined in RFC 959
Variables ¶
var ( SystemTypeUnixL8 = "UNIX Type: L8" SystemTypeWindowsNT = "Windows_NT" )
System types from Syst
var RePwdPath = regexp.MustCompile(`\"(.*)\"`)
RePwdPath is the default expression for matching files in the current working directory
Functions ¶
func StatusText ¶
StatusText returns a text for the FTP status code. It returns the empty string if the code is unknown.
Types ¶
type FTP ¶
type FTP struct {
// contains filtered or unexported fields
}
FTP is a session for File Transfer Protocol
func ConnectDbg ¶
ConnectDbg to server at addr (format "host:port"). debug is ON
func (*FTP) Login ¶
Login to the server with provided username and password. Typical default may be ("anonymous","").
func (*FTP) Quit ¶
Quit sends quit to the server and close the connection. No need to Close after this.
func (*FTP) RawCmd ¶
RawCmd sends raw commands to the remote server. Returns response code as int and response as string.
func (*FTP) ReadAndDiscard ¶
ReadAndDiscard reads all the buffered bytes and returns the number of bytes that cleared from the buffer
func (*FTP) Retr ¶
Retr retrieves file from remote host at path, using retrFn to read from the remote file.