ftp

package
v1.9.1 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2021 License: MIT Imports: 12 Imported by: 1

Documentation

Overview

Package ftp contains an FTP client implementation that supports health checks and tracing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

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

The Conn type represents a connection to an FTP server.

func Open

func Open(ctx context.Context, addr string, opts ...Option) (*Conn, error)

Open a connection to the specified FTP server, applying any provided options. See the Option type for configuration options.

func (*Conn) Close

func (c *Conn) Close() error

Close the connection to the FTP server.

func (*Conn) ListDir

func (c *Conn) ListDir(ctx context.Context, path string) ([]os.FileInfo, error)

ListDir returns a slice of os.FileInfo implementations for all files/directories found at the given path of the FTP server.

func (*Conn) NewReader

func (c *Conn) NewReader(path string) (io.ReadCloser, error)

NewReader returns a new io.ReadCloser implementation that reads the content of the file at the specified path.

func (*Conn) Ping

func (c *Conn) Ping() error

Ping asserts that the connection to the FTP server is alive and healthy.

func (*Conn) Walk

func (c *Conn) Walk(ctx context.Context, path string, fn filepath.WalkFunc) error

Walk walks the file tree rooted at root, calling fn for each file or directory in the tree. All errors that arise visiting files and directories are filtered by fn.

type FileInfo

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

FileInfo is an os.FileInfo implementation that represents FTP file information.

func (*FileInfo) IsDir

func (f *FileInfo) IsDir() bool

IsDir returns true if the current file is a directory.

func (*FileInfo) ModTime

func (f *FileInfo) ModTime() time.Time

ModTime returns the last modified time of the file.

func (*FileInfo) Mode

func (f *FileInfo) Mode() os.FileMode

Mode returns os.ModeDir if the os.FileMode implementation is a directory. Otherwise it returns os.ModeIrregular.

func (*FileInfo) Name

func (f *FileInfo) Name() string

Name returns the file name.

func (*FileInfo) Size

func (f *FileInfo) Size() int64

Size returns the file size in bytes.

func (*FileInfo) Sys

func (f *FileInfo) Sys() interface{}

Sys returns nil.

type Option

type Option func(c *config)

The Option type is a function used to configure the connection to the FTP server.

func WithCredentials

func WithCredentials(username, password string) Option

WithCredentials will cause the client to authenticate on open using the provided username and password combination.

Jump to

Keyboard shortcuts

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