Categorygithub.com/scriptrock/sftp
modulepackage
1.0.0
Repository: https://github.com/scriptrock/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.
MaxPacket sets the maximum size of the payload.
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.

# Variables

ErrBadPattern indicates a globbing pattern was malformed.

# Structs

Client represents an SFTP session on a *ssh.ClientConn SSH connection.
File represents a remote file.
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 (rename, remove, setstate, etc.).
FileInfoer should return file listing info and errors (readdir, stat) note stat requests would return a list of 1.
FileReader should return an io.Reader for the filepath.
FileWriter should return an io.Writer for the filepath.

# Type aliases

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