ftp

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package ftp implements the "ftp" protocol.Protocol driver. It speaks plain FTP and FTPS. The control connection is one command at a time, so a call takes one session from a pool and gives it back. Every transfer also opens a data connection.

The client library sets no deadline after the TCP connect. Each call sets a deadline on the control connection and on each data connection, and a watchdog closes those connections when the budget ends.

Uploads and deletes change files on the server. They need allow_writes, and a fixed path or a delete also needs allow_admin. An account that can only touch a scratch directory is the real lock.

Index

Constants

This section is empty.

Variables

View Source
var Options = append([]string{
	"mode", "path", "size", "fill", "expect_size", "expect_sha256", "expect",
	"limit", "hidden", "username", "password_env", "tls", "tls_verify", "tls_max",
	"sessions", "connection", "data_host", "epsv", "allow_writes", "allow_admin",
}, tlsconf.Keys...)

Options are the -opt keys this driver accepts.

Functions

This section is empty.

Types

type Driver

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

Driver is an FTP protocol.Protocol.

func New

func New(target protocol.Target, timeout time.Duration) (*Driver, error)

New builds a driver. It does not connect.

func NewConn

func NewConn(target protocol.Target, timeout time.Duration, password *string) (*Driver, error)

NewConn is New for a script. password is already known, so password_env is not read. The job of each call is set with Call.

func (*Driver) Call

func (d *Driver) Call(opts map[string]string, body []byte, timeout time.Duration) (*Driver, error)

Call returns a driver for one script call. It shares the pool. Close on it does nothing.

func (*Driver) Close

func (d *Driver) Close() error

Close quits idle sessions. A Call driver does nothing.

func (*Driver) Do

func (d *Driver) Do(ctx context.Context) (protocol.Result, error)

Do runs one iteration.

func (*Driver) DoTimed added in v0.9.0

DoTimed is Do, and it also returns the phase times of this call. One driver is shared by every VU, so the times stay on the return value and are never stored on the driver.

func (*Driver) Name

func (d *Driver) Name() string

Name is the protocol name.

func (*Driver) Run

func (d *Driver) Run(parent context.Context) (protocol.Result, Reply)

Run runs one call and returns the reply a script reads.

type Entry

type Entry = xfercommon.Entry

Entry, Timing and Reply are the shared file-transfer values.

type Reply

type Reply = xfercommon.Reply

type Timing

type Timing = xfercommon.Timing

Directories

Path Synopsis
Package ftptest is a small FTP server for tests.
Package ftptest is a small FTP server for tests.

Jump to

Keyboard shortcuts

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