internals

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2020 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const UploadPrefix = "upload-"

UploadPrefix is used when creating temporary files to save uploads to

Variables

This section is empty.

Functions

func HostKey

func HostKey(name string) (ssh.Signer, error)

HostKey reads private key from disk or creates it if necessary

func IsServiceUser

func IsServiceUser(p *ssh.Permissions) bool

IsServiceUser returns true if Permissions are created for service (deploy-agent) user that should only have read-only access.

func NewDownloadServer

func NewDownloadServer(rwc io.ReadWriteCloser, ifn FileListerFunc, rfn FileReadFunc) *sftp.RequestServer

NewDownloadServer returns read-only sftp.RequestServer that processes get requests with provided FileReadFunc and list, stat, readlink requests using provided FileListerFunc.

func NewUploadServer

func NewUploadServer(rwc io.ReadWriteCloser, dir string, callback func(name, hash string)) *sftp.RequestServer

NewUploadServer returns sftp.RequestServer that only handles file uploads (put requests) using newUploadHandlers.

func ServerSetup

func ServerSetup(keyFile, opAuth, srvAuth string) (ssh.Signer, *ssh.ServerConfig, error)

ServerSetup reads provided both authorized_keys files located at opAuth and srvAuth, reads or creates private key from keyFile and sets up ssh.ServerConfig using public key authentication.

Types

type FileListerFunc

type FileListerFunc func(*sftp.Request) (sftp.ListerAt, error)

FileListerFunc is a function from sftp.FileLister interface

type FileReadFunc

type FileReadFunc func(*sftp.Request) (io.ReaderAt, error)

FileReadFunc is a function from sftp.FileReader interface

type Listerat

type Listerat []os.FileInfo

Listerat implements sftp.ListerAt interface (copied from the sftp package)

func (Listerat) ListAt

func (f Listerat) ListAt(ls []os.FileInfo, offset int64) (int, error)

Modeled after strings.Reader's ReadAt() implementation

type SftpFile

type SftpFile interface {
	os.FileInfo
	io.ReaderAt
}

SftpFile combines interfaces required for sftp virtual file implementations

func NewFile

func NewFile(name string, dir bool, mtime time.Time, data []byte, sys *syscall.Stat_t) SftpFile

NewFile creates new virtual file

Jump to

Keyboard shortcuts

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