sftp

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package sftp provides an SFTP server that serves a facetfs.FileSystem on already-authenticated streams. The caller owns the SSH transport and authentication: run an SSH server, accept the "sftp" subsystem request on a session channel, and pass the channel to Serve.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

type Server struct {
	// FileSystem is the served filesystem. Required.
	//
	// Optional interfaces unlock protocol features: facetfs.SymlinkFS serves
	// symlink, readlink, and lstat; facetfs.SetStatFS serves setstat;
	// facetfs.StatVFSFS serves statvfs. Requests needing an interface the
	// FileSystem lacks fail with SSH_FX_OP_UNSUPPORTED.
	FileSystem facetfs.FileSystem
	// MaxPacketBytes caps the transmitted SFTP packet size. Zero means the
	// github.com/pkg/sftp default.
	MaxPacketBytes uint32
	// MaxDirectoryEntries caps a single directory listing. Zero means 100 000.
	MaxDirectoryEntries int
}

Server serves SFTP sessions from a FileSystem. The zero value of every optional field is usable.

func (*Server) Serve

func (s *Server) Serve(ctx context.Context, rwc io.ReadWriteCloser) error

Serve speaks SFTP on rwc — typically an ssh.Channel that accepted the "sftp" subsystem — until the client disconnects or ctx is canceled. Cancellation closes rwc. Serve returns nil on a clean client disconnect.

Jump to

Keyboard shortcuts

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