ftp

package
v0.9.6 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusInitiating    = 100
	StatusRestartMarker = 110
	StatusReadyMinute   = 120
	StatusAlreadyOpen   = 125
	StatusAboutToSend   = 150

	StatusCommandOK             = 200
	StatusCommandNotImplemented = 202
	StatusSystem                = 211
	StatusDirectory             = 212
	StatusFile                  = 213
	StatusHelp                  = 214
	StatusName                  = 215
	StatusReady                 = 220
	StatusClosing               = 221
	StatusDataConnectionOpen    = 225
	StatusClosingDataConnection = 226
	StatusPassiveMode           = 227
	StatusLongPassiveMode       = 228
	StatusExtendedPassiveMode   = 229
	StatusLoggedIn              = 230
	StatusLoggedOut             = 231
	StatusLogoutAck             = 232
	StatusAuthOK                = 234
	StatusRequestedFileActionOK = 250
	StatusPathCreated           = 257

	StatusUserOK             = 331
	StatusLoginNeedAccount   = 332
	StatusRequestFilePending = 350

	StatusNotAvailable             = 421
	StatusCanNotOpenDataConnection = 425
	StatusTransfertAborted         = 426
	StatusInvalidCredentials       = 430
	StatusHostUnavailable          = 434
	StatusFileActionIgnored        = 450
	StatusActionAborted            = 451
	Status452                      = 452

	StatusBadCommand              = 500
	StatusBadArguments            = 501
	StatusNotImplemented          = 502
	StatusBadSequence             = 503
	StatusNotImplementedParameter = 504
	StatusNotLoggedIn             = 530
	StatusStorNeedAccount         = 532
	StatusFileUnavailable         = 550
	StatusPageTypeUnknown         = 551
	StatusExceededStorage         = 552
	StatusBadFileName             = 553
)

Variables

This section is empty.

Functions

func StatusText

func StatusText(code int) string

StatusText returns a text for the FTP status code. It returns the empty string if the code is unknown.

Types

type Cfg

type Cfg struct {
	Addr    string `json:"addr"    validate:"required" yaml:"addr"`
	User    string `json:"user"    validate:"required" yaml:"user"`
	Pwd     string `json:"pwd"     yaml:"pwd"`
	Timeout int    `json:"timeout" validate:"gte=1"    yaml:"timeout"`
	Retry   int    `json:"retry"   validate:"gte=1"    yaml:"retry"`
}

func NewCfg

func NewCfg() *Cfg

type Client

type Client struct {
	*Cfg
	// contains filtered or unexported fields
}

func NewClient

func NewClient() *Client

func (*Client) ChangeDir

func (c *Client) ChangeDir(path string) error

func (*Client) Close

func (c *Client) Close() error

func (*Client) CurrentDir

func (c *Client) CurrentDir() (string, error)

func (*Client) Delete

func (c *Client) Delete(path string) error

func (*Client) DirExists

func (c *Client) DirExists(path string) (bool, error)

func (*Client) Init

func (c *Client) Init() error

func (*Client) List

func (c *Client) List(path string) ([]*Entry, error)

func (*Client) Mkdir

func (c *Client) Mkdir(name string) error

func (*Client) MkdirRecur

func (c *Client) MkdirRecur(path string) error

func (*Client) NameList

func (c *Client) NameList(path string) ([]string, error)

func (*Client) Quit

func (c *Client) Quit() error

func (*Client) RawCmd

func (c *Client) RawCmd(format string, args ...interface{}) (int, string, error)

func (*Client) TransType

func (c *Client) TransType(typ string) error

type Entry

type Entry struct {
	Name   string
	Target string // target of symbolic link
	Type   EntryType
	Size   uint64
	Time   time.Time
}

type EntryType

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

func (EntryType) String

func (t EntryType) String() string

type Reader

type Reader struct {
	*Client
	Path string
	// contains filtered or unexported fields
}

func NewReader

func NewReader() *Reader

func (*Reader) Close

func (r *Reader) Close() error

func (*Reader) Init

func (r *Reader) Init() error

func (*Reader) Read

func (r *Reader) Read(b []byte) (int, error)

type Response

type Response struct {
	// contains filtered or unexported fields
}

func (*Response) Close

func (r *Response) Close() error

func (*Response) Read

func (r *Response) Read(buf []byte) (int, error)

func (*Response) SetDeadline

func (r *Response) SetDeadline(t time.Time) error

type Writer

type Writer struct {
	*Client
	Path string
	// contains filtered or unexported fields
}

func NewWriter

func NewWriter() *Writer

func (*Writer) Close

func (w *Writer) Close() error

func (*Writer) Init

func (w *Writer) Init() error

func (*Writer) Write

func (w *Writer) Write(b []byte) (int, error)

Jump to

Keyboard shortcuts

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