Documentation
¶
Index ¶
- Constants
- Variables
- func IsSftpRequest(req *ssh.Request) bool
- func ServeChannel(c ssh.Channel, fs FileSystem, debugf DebugLogger) error
- type Attr
- type AutoSeekWriter
- type BufferedReader
- type Config
- type DebugLogger
- type Dir
- type DirReader
- type EmptyFS
- func (EmptyFS) CreateLink(p string, t string, f uint32) error
- func (EmptyFS) Mkdir(string, *Attr) error
- func (EmptyFS) OpenDir(string) (Dir, error)
- func (EmptyFS) OpenFile(string, uint32, *Attr) (File, error)
- func (EmptyFS) ReadLink(p string) (string, error)
- func (EmptyFS) RealPath(p string) (string, error)
- func (EmptyFS) Remove(string) error
- func (EmptyFS) Rename(string, string, uint32) error
- func (EmptyFS) Rmdir(string) error
- func (EmptyFS) SetStat(string, *Attr) error
- func (EmptyFS) Stat(string, bool) (*Attr, error)
- type EmptyFile
- type File
- type FileOpenArgs
- type FileSystem
- type FileSystemExtensionFileList
- type FileSystemExtentionFileTransfer
- type FileTransfer
- type NamedAttr
- type ReadAtCloser
- type SftpDriver
- type SftpServer
- type WriteAtCloser
- type WriteSeekCloser
Constants ¶
const ( ATTR_SIZE = ssh_FILEXFER_ATTR_SIZE ATTR_UIDGID = ssh_FILEXFER_ATTR_UIDGID ATTR_MODE = ssh_FILEXFER_ATTR_PERMISSIONS ATTR_TIME = ssh_FILEXFER_ATTR_ACMODTIME MODE_REGULAR = os.FileMode(0) MODE_DIR = os.ModeDir )
Variables ¶
var Failure = errors.New("Failure")
Functions ¶
func IsSftpRequest ¶
IsSftpRequest checks whether a given ssh.Request is for sftp.
func ServeChannel ¶
func ServeChannel(c ssh.Channel, fs FileSystem, debugf DebugLogger) error
ServeChannel serves a ssh.Channel with the given FileSystem.
Types ¶
type Attr ¶
type AutoSeekWriter ¶
type AutoSeekWriter struct {
// contains filtered or unexported fields
}
func (*AutoSeekWriter) Close ¶
func (a *AutoSeekWriter) Close() error
type BufferedReader ¶
type BufferedReader struct {
// contains filtered or unexported fields
}
func (*BufferedReader) Close ¶
func (b *BufferedReader) Close() error
type Config ¶
type Config struct {
// ServerConfig should be initialized properly with
// e.g. PasswordCallback and AddHostKey
ssh.ServerConfig
// HostPort specifies specifies [host]:port to listen on.
// e.g. ":2022" or "127.0.0.1:2023".
HostPort string
// ErrorLogFunc is used to log errors.
// e.g. log.Println has the right type.
ErrorLogFunc func(v ...interface{})
// DebugLogFunc is used to log debug infos.
// e.g. log.Printf has the right type.
DebugLogFunc DebugLogger
}
Config is the configuration struct for the high level API.
type DebugLogger ¶
type DebugLogger func(s string, v ...interface{})
type FileOpenArgs ¶
type FileOpenArgs struct {
// contains filtered or unexported fields
}
type FileSystem ¶
type FileSystem interface {
OpenFile(name string, flags uint32, attr *Attr) (File, error)
OpenDir(name string) (Dir, error)
Remove(name string) error
Rename(old, new string, flags uint32) error
Mkdir(name string, attr *Attr) error
Rmdir(name string) error
Stat(name string, islstat bool) (*Attr, error)
SetStat(name string, attr *Attr) error
ReadLink(path string) (string, error)
CreateLink(path string, target string, flags uint32) error
RealPath(path string) (string, error)
}
type FileSystemExtensionFileList ¶
type FileSystemExtensionFileList interface {
// ReadDir reads the directory named by name and return a list of directory entries.
ReadDir(name string) ([]NamedAttr, error)
}
FileSystemExtensionFileList is a convenience extension to allow to return file listing without requiring to implement the methods Open/Readdir for your custom afero.File From: github.com/fclairamb/ftpserverlib
type FileSystemExtentionFileTransfer ¶
type FileSystemExtentionFileTransfer interface {
// GetHandle return an handle to upload or download a file based on flags:
// os.O_RDONLY indicates a download
// os.O_WRONLY indicates an upload and can be combined with os.O_APPEND (resume) or
// os.O_CREATE (upload to new file/truncate)
//
// offset is the argument of a previous REST command, if any, or 0
GetHandle(name string, flags uint32, attr *Attr, offset uint64) (FileTransfer, error)
}
FileSystemExtentionFileTransfer is a convenience extension to allow to transfer files without requiring to implement the methods Create/Open/OpenFile for your custom afero.File. From: github.com/fclairamb/ftpserverlib
type FileTransfer ¶
FileTransfer defines the inferface for file transfers. From: github.com/fclairamb/ftpserverlib
type SftpDriver ¶
type SftpDriver interface {
GetConfig() *Config
GetFileSystem(sc *ssh.ServerConn) (FileSystem, error)
Close()
}
type SftpServer ¶
type SftpServer struct {
// contains filtered or unexported fields
}
func NewSftpServer ¶
func NewSftpServer(driver SftpDriver) *SftpServer
NewSftpServer inits a SFTP Server.
func (*SftpServer) BlockTillReady ¶
func (s *SftpServer) BlockTillReady() error
BlockTillReady will block till the Config is ready to accept connections. Returns an error if listening failed. Can be called in a concurrent fashion. This is new API - make sure Init is called on the Config before using it.
func (*SftpServer) Close ¶
func (s *SftpServer) Close() error
Close closes the server assosiated with this config. Can be called in a concurrent fashion. This is new API - make sure Init is called on the Config before using it.
func (*SftpServer) LogError ¶
func (s *SftpServer) LogError(v ...interface{})
func (*SftpServer) RunServer ¶
func (s *SftpServer) RunServer() error
RunServer runs the server using the high level API.
type WriteSeekCloser ¶
type WriteSeekCloser interface {
io.WriteSeeker
io.Closer
}
