sftp

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: 22 Imported by: 0

Documentation

Overview

Package sftp implements the "sftp" protocol.Protocol driver. It speaks the SSH File Transfer Protocol. One SSH connection is shared by the calls that use it, and those calls are multiplexed on one channel.

The SSH and SFTP libraries do not take a context. Each call runs a watchdog that closes the connection when the budget ends. A timeout closes that shared connection, so other calls on it fail too.

Index

Constants

This section is empty.

Variables

View Source
var Options = []string{
	"mode", "path", "size", "fill", "expect_size", "expect_sha256", "expect",
	"limit", "hidden", "username", "password_env", "key_file", "key_passphrase_env",
	"host_key", "connections", "connection", "allow_writes", "allow_admin",
	"concurrent_writes",
}

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 SFTP 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, passphrase *string) (*Driver, error)

NewConn is New for a script. password and passphrase are already known, so the environment variables are 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 connections. Close on it does nothing.

func (*Driver) Close

func (d *Driver) Close() error

Close closes the shared connections. 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

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, xfercommon.Reply)

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

Directories

Path Synopsis
Package sftptest is an SSH server with an SFTP subsystem for tests.
Package sftptest is an SSH server with an SFTP subsystem for tests.

Jump to

Keyboard shortcuts

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