session

package
v2.3.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2018 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VNC    = "vnc"
	ALIYUN = "aliyun"
	SPICE  = "spice"
	WMKS   = "wmks"
)

Variables

View Source
var (
	Manager        *SSessionManager
	AES_KEY        string
	AccessInterval time.Duration = 5 * time.Minute
)

Functions

This section is empty.

Types

type ISessionData

type ISessionData interface {
	command.ICommand
}

type Pty

type Pty struct {
	Session *SSession
	Cmd     *exec.Cmd
	Pty     *os.File

	Show    bool
	IsOk    bool
	Buffer  string
	Output  string
	Command string
	Exit    bool
	// contains filtered or unexported fields
}

func NewPty

func NewPty(session *SSession) (p *Pty, err error)

func (*Pty) Resize

func (p *Pty) Resize(size *pty.Winsize)

func (*Pty) Stop

func (p *Pty) Stop()

type RemoteConsoleInfo

type RemoteConsoleInfo struct {
	Host     string `json:"host"`
	Port     int64  `json:"port"`
	Protocol string `json:"protocol"`
	Id       string `json:"id"`
	OsName   string `json:"osName"`

	// used by aliyun server
	InstanceId string `json:"instance_id"`
	Url        string `json:"url"`
	Password   string `json:"password"`
}

func NewRemoteConsoleInfoByCloud

func NewRemoteConsoleInfoByCloud(s *mcclient.ClientSession, serverId string) (*RemoteConsoleInfo, error)

func (*RemoteConsoleInfo) Cleanup

func (info *RemoteConsoleInfo) Cleanup() error

Cleanup implements ISessionData interface

func (*RemoteConsoleInfo) GetCommand

func (info *RemoteConsoleInfo) GetCommand() *exec.Cmd

GetCommand implements ISessionData interface

func (*RemoteConsoleInfo) GetConnectParams

func (info *RemoteConsoleInfo) GetConnectParams() (string, error)

func (*RemoteConsoleInfo) GetData

func (info *RemoteConsoleInfo) GetData(s string) (bool, string, string)

GetData implements ISessionData interface

func (*RemoteConsoleInfo) GetProtocol

func (info *RemoteConsoleInfo) GetProtocol() string

GetProtocol implements ISessionData interface

func (*RemoteConsoleInfo) ShowInfo

func (info *RemoteConsoleInfo) ShowInfo() string

ShowInfo implements ISessionData interface

type SSession

type SSession struct {
	ISessionData
	Id          string
	AccessToken string
	AccessedAt  time.Time
}

func (*SSession) Close

func (s *SSession) Close() error

func (SSession) GetConnectParams

func (s SSession) GetConnectParams() (string, error)

type SSessionManager

type SSessionManager struct {
	*sync.Map
}

func NewSessionManager

func NewSessionManager() *SSessionManager

func (*SSessionManager) Get

func (man *SSessionManager) Get(accessToken string) (*SSession, bool)

func (*SSessionManager) Save

func (man *SSessionManager) Save(data ISessionData) (session *SSession, err error)

Jump to

Keyboard shortcuts

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