Categorygithub.com/polygon-io/sftp
modulepackage
1.10.0
Repository: https://github.com/polygon-io/sftp.git
Documentation: pkg.go.dev

# README

sftp

The sftp package provides support for file system operations on remote ssh servers using the SFTP subsystem. It also implements an SFTP server for serving files from the filesystem.

UNIX Build Status GoDoc

usage and examples

See godoc.org/github.com/pkg/sftp for examples and usage.

The basic operation of the package mirrors the facilities of the os package.

The Walker interface for directory traversal is heavily inspired by Keith Rarick's fs package.

roadmap

  • There is way too much duplication in the Client methods. If there was an unmarshal(interface{}) method this would reduce a heap of the duplication.

contributing

We welcome pull requests, bug fixes and issue reports.

Before proposing a large change, first please discuss your change by raising an issue.

For API/code bugs, please include a small, self contained code example to reproduce the issue. For pull requests, remember test coverage.

We try to handle issues and pull requests with a 0 open philosophy. That means we will try to address the submission as soon as possible and will work toward a resolution. If progress can no longer be made (eg. unreproducible bug) or stops (eg. unresponsive submitter), we will close the bug.

Thanks.

# Packages

No description provided by the author
No description provided by the author

# Functions

InMemHandler returns a Hanlders object with the test handlers.
Join joins any number of path elements into a single path, adding a Separator if necessary.
Match reports whether name matches the shell file name pattern.
MaxConcurrentRequestsPerFile sets the maximum concurrent requests allowed for a single file.
MaxPacket sets the maximum size of the payload, measured in bytes.
MaxPacketChecked sets the maximum size of the payload, measured in bytes.
MaxPacketUnchecked sets the maximum size of the payload, measured in bytes.
NewClient creates a new SFTP client on conn, using zero or more option functions.
NewClientPipe creates a new SFTP client given a Reader and a WriteCloser.
NewRequest creates a new Request object.
NewRequestServer creates/allocates/returns new RequestServer.
NewServer creates a new Server instance around the provided streams, serving content from the root of the filesystem.
ReadOnly configures a Server to serve files in read-only mode.
Split splits path immediately following the final Separator, separating it into a directory and file name component.
WithDebug enables Server debugging output to the supplied io.Writer.

# Constants

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Variables

ErrBadPattern indicates a globbing pattern was malformed.
InternalInconsistency indicates the packets sent and the data queued to be written to the file don't match up.
MaxFilelist is the max number of files to return in a readdir batch.

# Structs

Client represents an SFTP session on a *ssh.ClientConn SSH connection.
File represents a remote file.
Flags that indicate whether SFTP file attributes were passed.
File Open and Write Flags.
FileStat holds the original unmarshalled values from a call to READDIR or *STAT.
Handlers contains the 4 SFTP server request handlers.
Request contains the data and state for the incoming service request.
RequestServer abstracts the sftp protocol with an http request-like protocol.
Server is an SSH File Transfer Protocol (sftp) server.
StatExtended contains additional, extended information for a FileStat.
A StatusError is returned when an SFTP operation fails, and provides additional information about the failure.
A StatVFS contains statistics about a filesystem.

# Interfaces

FileCmder should return an error Note in cases of an error, the error text will be sent to the client.
FileLister should return an object that fulfils the ListerAt interface Note in cases of an error, the error text will be sent to the client.
FileReader should return an io.ReaderAt for the filepath Note in cases of an error, the error text will be sent to the client.
FileWriter should return an io.WriterAt for the filepath.
ListerAt does for file lists what io.ReaderAt does for files.

# Type aliases

A ClientOption is a function which applies configuration to a Client.
A ServerOption is a function which applies configuration to a Server.