Documentation ¶
Index ¶
- Constants
- type FileAction
- type Handler
- func (h *Handler) Filecmd(request *sftp.Request) error
- func (h *Handler) Filelist(request *sftp.Request) (sftp.ListerAt, error)
- func (h *Handler) Fileread(request *sftp.Request) (io.ReaderAt, error)
- func (h *Handler) Filewrite(request *sftp.Request) (io.WriterAt, error)
- func (h *Handler) Handlers() sftp.Handlers
- type ListerAt
- type SFTPServer
Constants ¶
const ( PermissionFileRead = "file.read" PermissionFileReadContent = "file.read-content" PermissionFileCreate = "file.create" PermissionFileUpdate = "file.update" PermissionFileDelete = "file.delete" )
const ( // ErrSSHQuotaExceeded 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 FileAction ¶
type FileAction struct { // Entity is the targeted file or directory (depending on the event) that the action // is being performed _against_, such as "/foo/test.txt". This will always be the full // path to the element. Entity string // Target is an optional (often blank) field that only has a value in it when the event // is specifically modifying the entity, such as a rename or move event. In that case // the Target field will be the final value, such as "/bar/new.txt" Target string }
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
func NewHandler ¶
NewHandler returns a new connection handler for the SFTP server. This allows a given user to access the underlying filesystem.
func (*Handler) Filecmd ¶
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 ¶
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 ¶
Fileread creates a reader for a file on the system and returns the reader back.
type SFTPServer ¶
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 ¶
func (c *SFTPServer) AcceptInbound(conn net.Conn, config *ssh.ServerConfig) error
AcceptInbound handles an inbound connection to the instance and determines if we should serve the request or not.
func (*SFTPServer) PrivateKeyPath ¶
func (c *SFTPServer) PrivateKeyPath() string
PrivateKeyPath returns the path the host private key for this server instance.
func (*SFTPServer) Run ¶
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.