session

package
v0.3.10-0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2022 License: Apache-2.0 Imports: 25 Imported by: 4

Documentation

Index

Constants

View Source
const (
	VNC       = api.VNC
	ALIYUN    = api.ALIYUN
	QCLOUD    = api.QCLOUD
	OPENSTACK = api.OPENSTACK
	SPICE     = api.SPICE
	WMKS      = api.WMKS
	VMRC      = api.VMRC
	ZSTACK    = api.ZSTACK
	CTYUN     = api.CTYUN
	HUAWEI    = api.HUAWEI
	HCS       = api.HCS
	APSARA    = api.APSARA
	JDCLOUD   = api.JDCLOUD
	CLOUDPODS = api.CLOUDPODS
)

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
	GetId() string
}

type Pty

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

	OriginSize *pty.Winsize
	Exit       bool
	// contains filtered or unexported fields
}

func NewPty

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

func (*Pty) IsInShellMode

func (p *Pty) IsInShellMode() bool

func (*Pty) Read

func (p *Pty) Read() ([]byte, error)

func (*Pty) Resize

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

func (*Pty) Stop

func (p *Pty) Stop() (err error)

type RandomSessionData

type RandomSessionData struct {
	command.ICommand
	// contains filtered or unexported fields
}

func WrapCommandSession

func WrapCommandSession(cmd command.ICommand) *RandomSessionData

func (*RandomSessionData) GetId

func (s *RandomSessionData) GetId() string

type RemoteConsoleInfo

type RemoteConsoleInfo struct {
	cloudprovider.ServerVncOutput
	// contains filtered or unexported fields
}

func NewRemoteConsoleInfoByCloud

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

func (*RemoteConsoleInfo) Cleanup

func (info *RemoteConsoleInfo) Cleanup() error

Cleanup implements ISessionData interface

func (*RemoteConsoleInfo) Connect

func (info *RemoteConsoleInfo) Connect() error

Connect implements ISessionData interface

func (*RemoteConsoleInfo) GetClientSession

func (info *RemoteConsoleInfo) GetClientSession() *mcclient.ClientSession

func (*RemoteConsoleInfo) GetCommand

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

GetCommand implements ISessionData interface

func (*RemoteConsoleInfo) GetConnectParams

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

func (*RemoteConsoleInfo) GetId

func (info *RemoteConsoleInfo) GetId() string

func (*RemoteConsoleInfo) GetPassword

func (info *RemoteConsoleInfo) GetPassword() string

func (*RemoteConsoleInfo) GetProtocol

func (info *RemoteConsoleInfo) GetProtocol() string

GetProtocol implements ISessionData interface

func (*RemoteConsoleInfo) GetRecordObject

func (info *RemoteConsoleInfo) GetRecordObject() *recorder.Object

func (*RemoteConsoleInfo) IsNeedShowInfo

func (info *RemoteConsoleInfo) IsNeedShowInfo() bool

IsNeedShowInfo implements ISessionData interface

func (*RemoteConsoleInfo) Reconnect

func (info *RemoteConsoleInfo) Reconnect()

Reconnect implements ISessionData interface

func (*RemoteConsoleInfo) Scan

func (info *RemoteConsoleInfo) Scan(byte, func(string))

Scan 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
	// contains filtered or unexported fields
}

func (*SSession) Close

func (s *SSession) Close() error

func (SSession) GetConnectParams

func (s SSession) GetConnectParams(params url.Values) (string, error)

func (*SSession) GetRecorder

func (s *SSession) GetRecorder() recorder.Recoder

func (*SSession) RegisterDuplicateHook

func (s *SSession) RegisterDuplicateHook(f func())

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) (*SSession, error)

Jump to

Keyboard shortcuts

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