sftp

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2021 License: MIT Imports: 23 Imported by: 1

Documentation

Index

Constants

View Source
const (
	PermissionFileRead        = "file.read"
	PermissionFileReadContent = "file.read-content"
	PermissionFileCreate      = "file.create"
	PermissionFileUpdate      = "file.update"
	PermissionFileDelete      = "file.delete"
)
View Source
const (
	// Extends the default SFTP server to return a quota exceeded error to the client.
	//
	// @see https://tools.ietf.org/id/draft-ietf-secsh-filexfer-13.txt
	ErrSSHQuotaExceeded = fxerr(15)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler added in v1.3.0

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

func NewHandler added in v1.3.0

func NewHandler(sc *ssh.ServerConn, srv *server.Server) *Handler

Returns a new connection handler for the SFTP server. This allows a given user to access the underlying filesystem.

func (*Handler) Filecmd added in v1.3.0

func (h *Handler) Filecmd(request *sftp.Request) error

Filecmd hander for basic SFTP system calls related to files, but not anything to do with reading or writing to those files.

func (*Handler) Filelist added in v1.3.0

func (h *Handler) Filelist(request *sftp.Request) (sftp.ListerAt, error)

Filelist is the handler for SFTP filesystem list calls. This will handle calls to list the contents of a directory as well as perform file/folder stat calls.

func (*Handler) Fileread added in v1.3.0

func (h *Handler) Fileread(request *sftp.Request) (io.ReaderAt, error)

Fileread creates a reader for a file on the system and returns the reader back.

func (*Handler) Filewrite added in v1.3.0

func (h *Handler) Filewrite(request *sftp.Request) (io.WriterAt, error)

Filewrite handles the write actions for a file on the system.

func (*Handler) Handlers added in v1.3.0

func (h *Handler) Handlers() sftp.Handlers

Returns the sftp.Handlers for this struct.

type ListerAt

type ListerAt []os.FileInfo

func (ListerAt) ListAt

func (l ListerAt) ListAt(f []os.FileInfo, offset int64) (int, error)

Returns the number of entries copied and an io.EOF error if we made it to the end of the file list. Take a look at the pkg/sftp godoc for more information about how this function should work.

type SFTPServer added in v1.3.0

type SFTPServer struct {
	BasePath string
	ReadOnly bool
	Listen   string
	// contains filtered or unexported fields
}

func New

func New(m *server.Manager) *SFTPServer

func (*SFTPServer) AcceptInbound added in v1.3.0

func (c *SFTPServer) AcceptInbound(conn net.Conn, config *ssh.ServerConfig)

Handles an inbound connection to the instance and determines if we should serve the request or not.

func (*SFTPServer) PrivateKeyPath added in v1.5.2

func (c *SFTPServer) PrivateKeyPath() string

PrivateKeyPath returns the path the host private key for this server instance.

func (*SFTPServer) Run added in v1.3.0

func (c *SFTPServer) Run() error

Run starts the SFTP server and add a persistent listener to handle inbound SFTP connections. This will automatically generate an ED25519 key if one does not already exist on the system for host key verification purposes.

Jump to

Keyboard shortcuts

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