files

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2018 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DispatchSftpMessage

func DispatchSftpMessage(messageType int, message []byte, client *sftp.Client) error

func ForkSftpClient

func ForkSftpClient(key string) *sftp.Client

make a copy of SftpEntity matched with given key. return sftp.client pointer or nil pointer.

func Join

func Join(key string, sftpEntity SftpEntity)

add a sftp client to subscribers list.

func Leave

func Leave(key string)

remove a sftp client by key.

func UploadFile

func UploadFile(desPath string, client *sftp.Client, srcFile multipart.File, header *multipart.FileHeader) error

upload file to server via sftp. * @desPath: relative path in remote server.

Types

type Download

type Download struct{}

func (Download) ServeAfterAuthenticated

func (d Download) ServeAfterAuthenticated(w http.ResponseWriter, r *http.Request, claims *utils.Claims, session utils.Session)

func (Download) ShouldClearSessionAfterExec

func (d Download) ShouldClearSessionAfterExec() bool

type FileStat

type FileStat struct{}

func (FileStat) ServeAfterAuthenticated

func (f FileStat) ServeAfterAuthenticated(w http.ResponseWriter, r *http.Request, claims *utils.Claims, session *utils.Session)

func (FileStat) ShouldClearSessionAfterExec

func (f FileStat) ShouldClearSessionAfterExec() bool

type FileUpload

type FileUpload struct{}

func (FileUpload) ServeAfterAuthenticated

func (f FileUpload) ServeAfterAuthenticated(w http.ResponseWriter, r *http.Request, claims *utils.Claims, session utils.Session)

func (FileUpload) ShouldClearSessionAfterExec

func (f FileUpload) ShouldClearSessionAfterExec() bool

type List

type List struct{}

func (List) ServeAfterAuthenticated

func (f List) ServeAfterAuthenticated(w http.ResponseWriter, r *http.Request, claims *utils.Claims, session utils.Session)

func (List) ShouldClearSessionAfterExec

func (f List) ShouldClearSessionAfterExec() bool

type Ls

type Ls struct {
	Name  string `json:"name"`
	Path  string `json:"path"` // including Name
	IsDir bool   `json:"is_dir"`
}

type SftpEntity

type SftpEntity struct {
	// contains filtered or unexported fields
}

func Fork

func Fork(key string) (SftpEntity, bool)

make a copy of SftpEntity matched with given key. return sftpEntity and exist flag (bool).

func NewSftpEntity

func NewSftpEntity(user SftpNode, username, password string) (SftpEntity, error)

func (*SftpEntity) Close

func (con *SftpEntity) Close()

close sftp session and ssh client

type SftpEstablish

type SftpEstablish struct{}

func (SftpEstablish) ServeAfterAuthenticated

func (e SftpEstablish) ServeAfterAuthenticated(w http.ResponseWriter, r *http.Request, claims *utils.Claims, session utils.Session)

establish webSocket connection to browser to maintain connection with remote sftp server. If establish success, add sftp connection to a list. and then, handle all message from message (e.g.list files in one directory.).

func (SftpEstablish) ShouldClearSessionAfterExec

func (e SftpEstablish) ShouldClearSessionAfterExec() bool

type SftpNode

type SftpNode utils.Node // struct alias.

Jump to

Keyboard shortcuts

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