Documentation
¶
Overview ¶
Package sftpd is sftp (SSH File Transfer Protocol) server library.
Index ¶
- Constants
- Variables
- func IsSftpRequest(req *ssh.Request) bool
- func ServeChannel(c ssh.Channel, fs FileSystem) error
- type Attr
- type Config
- type Dir
- 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 FileSystem
- type NamedAttr
Constants ¶
View Source
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 ¶
View Source
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) error
ServeChannel serves a ssh.Channel with the given FileSystem.
Types ¶
type Attr ¶
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 // LogFunction is used to log errors. // e.g. log.Println has the right type. LogFunc func(v ...interface{}) // FileSystem contains the FileSystem used for this server. FileSystem FileSystem // contains filtered or unexported fields }
Config is the configuration struct for the high level API.
func (*Config) BlockTillReady ¶
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.
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 string, 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) }
Source Files
¶
Click to show internal directories.
Click to hide internal directories.