httpd

package
v0.0.0-...-f69eaad Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2020 License: GPL-3.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Timeout = time.Duration(60)
)

Functions

func AuthDecorator

func AuthDecorator(handler http.HandlerFunc) http.HandlerFunc

func GetWebsocketAddr

func GetWebsocketAddr(ns *neffos.NSConn) string

func JoinRoom

func JoinRoom(c *Client, roomID string)

func NewElfinderFileInfo

func NewElfinderFileInfo(id, dirPath string, originFileInfo os.FileInfo) elfinder.FileDir

func OnDataHandler

func OnDataHandler(c *neffos.NSConn, msg neffos.Message) (err error)

OnDataHandler 收发数据时触发

func OnELFinderConnect

func OnELFinderConnect(ns *neffos.NSConn, msg neffos.Message) error

func OnELFinderDisconnect

func OnELFinderDisconnect(c *neffos.NSConn, msg neffos.Message) error

func OnHostHandler

func OnHostHandler(ns *neffos.NSConn, msg neffos.Message) (err error)

OnHostHandler 当用户连接Host时触发

func OnLogoutHandler

func OnLogoutHandler(c *neffos.NSConn, msg neffos.Message) (err error)

OnLogoutHandler 用户登出一个会话时触发, 用户主动退出

func OnNamespaceConnected

func OnNamespaceConnected(ns *neffos.NSConn, msg neffos.Message) error

OnConnectHandler 当websocket连接后触发

func OnNamespaceDisconnect

func OnNamespaceDisconnect(c *neffos.NSConn, msg neffos.Message) (err error)

OnDisconnect websocket断开后触发

func OnPingHandler

func OnPingHandler(c *neffos.NSConn, msg neffos.Message) error

func OnResizeHandler

func OnResizeHandler(c *neffos.NSConn, msg neffos.Message) (err error)

OnResizeHandler 用户窗口改变时触发

func OnShareRoom

func OnShareRoom(ns *neffos.NSConn, msg neffos.Message) (err error)

func OnTokenHandler

func OnTokenHandler(ns *neffos.NSConn, msg neffos.Message) (err error)

OnTokenHandler 当使用token连接时触发

func StartHTTPServer

func StartHTTPServer()

func StopHTTPServer

func StopHTTPServer()

func TrimPrefix

func TrimPrefix(path string) string

Types

type Client

type Client struct {
	Uuid      string
	WinChan   chan ssh.Window
	UserRead  io.Reader
	UserWrite io.WriteCloser
	Conn      *UserWebsocketConn
	// contains filtered or unexported fields
}

func (*Client) Close

func (c *Client) Close() (err error)

func (*Client) ID

func (c *Client) ID() string

func (*Client) LoginFrom

func (c *Client) LoginFrom() string

func (*Client) Pty

func (c *Client) Pty() ssh.Pty

func (*Client) Read

func (c *Client) Read(p []byte) (n int, err error)

func (*Client) RemoteAddr

func (c *Client) RemoteAddr() string

func (*Client) SetWinSize

func (c *Client) SetWinSize(size ssh.Window)

func (*Client) WinCh

func (c *Client) WinCh() <-chan ssh.Window

func (*Client) Write

func (c *Client) Write(p []byte) (n int, err error)

type DataMsg

type DataMsg struct {
	Data string `json:"data"`
	Room string `json:"room"`
}

type EmitSidMsg

type EmitSidMsg struct {
	Sid string `json:"sid"`
}

type HostMsg

type HostMsg struct {
	Uuid     string `json:"uuid"`
	UserID   string `json:"userid"`
	Secret   string `json:"secret"`
	Size     []int  `json:"size"`
	HostType string `json:"type"`
}

type LogoutMsg

type LogoutMsg struct {
	Room string `json:"room"`
	Data string `json:"data"`
}

type ResizeMsg

type ResizeMsg struct {
	Height int `json:"rows"`
	Width  int `json:"cols"`
}

type RoomMsg

type RoomMsg struct {
	Room   string `json:"room"`
	Secret string `json:"secret"`
}

type TokenMsg

type TokenMsg struct {
	Token  string `json:"token"`
	Secret string `json:"secret"`
	Size   []int  `json:"size"`
}

type UserVolume

type UserVolume struct {
	Uuid     string
	UserSftp *srvconn.UserSftpConn
	Homename string
	// contains filtered or unexported fields
}

func NewUserVolume

func NewUserVolume(user *model.User, addr, hostId string) *UserVolume

func (*UserVolume) Close

func (u *UserVolume) Close()

func (*UserVolume) GetFile

func (u *UserVolume) GetFile(path string) (reader io.ReadCloser, err error)

func (*UserVolume) ID

func (u *UserVolume) ID() string

func (*UserVolume) Info

func (u *UserVolume) Info(path string) (elfinder.FileDir, error)

func (*UserVolume) List

func (u *UserVolume) List(path string) []elfinder.FileDir

func (*UserVolume) MakeDir

func (u *UserVolume) MakeDir(dir, newDirname string) (elfinder.FileDir, error)

func (*UserVolume) MakeFile

func (u *UserVolume) MakeFile(dir, newFilename string) (elfinder.FileDir, error)

func (*UserVolume) MergeChunk

func (u *UserVolume) MergeChunk(cid, total int, dirPath, uploadPath, filename string) (elfinder.FileDir, error)

func (*UserVolume) Parents

func (u *UserVolume) Parents(path string, dep int) []elfinder.FileDir

func (*UserVolume) Paste

func (u *UserVolume) Paste(dir, filename, suffix string, reader io.ReadCloser) (elfinder.FileDir, error)

func (*UserVolume) Remove

func (u *UserVolume) Remove(path string) error

func (*UserVolume) Rename

func (u *UserVolume) Rename(oldNamePath, newName string) (elfinder.FileDir, error)

func (*UserVolume) RootFileDir

func (u *UserVolume) RootFileDir() elfinder.FileDir

func (*UserVolume) Search

func (u *UserVolume) Search(path, key string, mimes ...string) (res []elfinder.FileDir, err error)

func (*UserVolume) UploadChunk

func (u *UserVolume) UploadChunk(cid int, dirPath, uploadPath, filename string, rangeData elfinder.ChunkRange, reader io.Reader) error

func (*UserVolume) UploadFile

func (u *UserVolume) UploadFile(dirPath, uploadPath, filename string, reader io.Reader) (elfinder.FileDir, error)

type UserWebsocketConn

type UserWebsocketConn struct {
	User *model.User

	Addr string
	// contains filtered or unexported fields
}

func NewUserWebsocketConnWithSession

func NewUserWebsocketConnWithSession(ns *neffos.NSConn) (*UserWebsocketConn, error)

func NewUserWebsocketConnWithTokenUser

func NewUserWebsocketConnWithTokenUser(ns *neffos.NSConn, tokenUser model.TokenUser) (*UserWebsocketConn, error)

func (*UserWebsocketConn) AddClient

func (u *UserWebsocketConn) AddClient(id string, client *Client)

func (*UserWebsocketConn) CheckShareRoomReadPerm

func (u *UserWebsocketConn) CheckShareRoomReadPerm(shareRoomID string) bool

func (*UserWebsocketConn) CheckShareRoomWritePerm

func (u *UserWebsocketConn) CheckShareRoomWritePerm(shareRoomID string) bool

func (*UserWebsocketConn) Close

func (u *UserWebsocketConn) Close()

func (*UserWebsocketConn) DeleteClient

func (u *UserWebsocketConn) DeleteClient(id string)

func (*UserWebsocketConn) GetClient

func (u *UserWebsocketConn) GetClient(id string) (client *Client, ok bool)

func (*UserWebsocketConn) ReceiveDataEvent

func (u *UserWebsocketConn) ReceiveDataEvent(data DataMsg) error

func (*UserWebsocketConn) ReceiveLogoutEvent

func (u *UserWebsocketConn) ReceiveLogoutEvent(clientID string)

func (*UserWebsocketConn) ReceiveResizeEvent

func (u *UserWebsocketConn) ReceiveResizeEvent(size ssh.Window)

func (*UserWebsocketConn) SendDataEvent

func (u *UserWebsocketConn) SendDataEvent(data []byte)

func (*UserWebsocketConn) SendLogoutEvent

func (u *UserWebsocketConn) SendLogoutEvent(data []byte)

func (*UserWebsocketConn) SendPongEvent

func (u *UserWebsocketConn) SendPongEvent()

func (*UserWebsocketConn) SendRoomEvent

func (u *UserWebsocketConn) SendRoomEvent(data []byte)

func (*UserWebsocketConn) SendShareRoomDataEvent

func (u *UserWebsocketConn) SendShareRoomDataEvent(data []byte)

type VolumeCloser

type VolumeCloser interface {
	elfinder.Volume
	Close()
}

func GetUserVolume

func GetUserVolume(sid string) (VolumeCloser, bool)

type WebsocketManager

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

func (*WebsocketManager) AddUserCon

func (m *WebsocketManager) AddUserCon(id string, conn *UserWebsocketConn)

func (*WebsocketManager) DeleteUserCon

func (m *WebsocketManager) DeleteUserCon(id string)

func (*WebsocketManager) GetUserCon

func (m *WebsocketManager) GetUserCon(id string) (conn *UserWebsocketConn, ok bool)

func (*WebsocketManager) GetWebsocketData

func (m *WebsocketManager) GetWebsocketData() map[string]interface{}

Jump to

Keyboard shortcuts

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