Documentation ¶
Index ¶
- Constants
- func HostKey(name string) (ssh.Signer, error)
- func IsServiceUser(p *ssh.Permissions) bool
- func NewDownloadServer(rwc io.ReadWriteCloser, ifn FileListerFunc, rfn FileReadFunc) *sftp.RequestServer
- func NewUploadServer(rwc io.ReadWriteCloser, dir string, callback func(name, hash string)) *sftp.RequestServer
- func ServerSetup(keyFile, opAuth, srvAuth string) (ssh.Signer, *ssh.ServerConfig, error)
- type FileListerFunc
- type FileReadFunc
- type Listerat
- type SftpFile
Constants ¶
const UploadPrefix = "upload-"
UploadPrefix is used when creating temporary files to save uploads to
Variables ¶
This section is empty.
Functions ¶
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 ¶
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 ¶
FileListerFunc is a function from sftp.FileLister interface
type FileReadFunc ¶
FileReadFunc is a function from sftp.FileReader interface