ftps

package module
v0.0.0-...-60e520f Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2018 License: ISC Imports: 13 Imported by: 0

README

FTPS Implementation for Go

Information

This implementation does not implement the full FTP/FTPS specification. Only a small subset.

I have not done a security review of the code, yet. Therefore no guarantee is given. It would be nice if somebody could do a security review and report back if the implementation is vulnerable.

Installation

go get github.com/webguerilla/ftps

Usage

ftps := new(FTPS)

ftps.TLSConfig.InsecureSkipVerify = true // often necessary in shared hosting environments
ftps.Debug = true

err := ftps.Connect("localhost", 21)
if err != nil {
	panic(err)
}

err = ftps.Login("username", "password")
if err != nil {
	panic(err)
}

directory, err := ftps.PrintWorkingDirectory()
if err != nil {
	panic(err)
}
log.Printf("Current working directory: %s", directory)

err = ftps.Quit()
if err != nil {
	panic(err)
}

Credits

This work was inspired by the work of jlaffaye (https://github.com/jlaffaye/ftp) and smallfish (https://github.com/smallfish/ftp).

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	Type EntryType
	Name string
	Size uint64
	Time time.Time
}

type EntryType

type EntryType int
const (
	EntryTypeFile EntryType = iota
	EntryTypeFolder
	EntryTypeLink
)

type FTPS

type FTPS struct {
	Debug     bool
	TLSConfig tls.Config
	// contains filtered or unexported fields
}

func (*FTPS) ChangeWorkingDirectory

func (ftps *FTPS) ChangeWorkingDirectory(path string) (err error)

func (*FTPS) Connect

func (ftps *FTPS) Connect(host string, port int) (err error)

func (*FTPS) DeleteFile

func (ftps *FTPS) DeleteFile(path string) (err error)

func (*FTPS) List

func (ftps *FTPS) List() (entries []Entry, err error)

func (*FTPS) Login

func (ftps *FTPS) Login(username, password string) (err error)

func (*FTPS) MakeDirectory

func (ftps *FTPS) MakeDirectory(path string) (err error)

func (*FTPS) PrintWorkingDirectory

func (ftps *FTPS) PrintWorkingDirectory() (directory string, err error)

func (*FTPS) Quit

func (ftps *FTPS) Quit() (err error)

func (*FTPS) RemoveDirectory

func (ftps *FTPS) RemoveDirectory(path string) (err error)

func (*FTPS) RetrieveFile

func (ftps *FTPS) RetrieveFile(remoteFilepath, localFilepath string) (err error)

func (*FTPS) RetrieveFileData

func (ftps *FTPS) RetrieveFileData(remoteFilepath string) (data []byte, err error)

func (*FTPS) StoreFile

func (ftps *FTPS) StoreFile(remoteFilepath string, data []byte) (err error)

Jump to

Keyboard shortcuts

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