Documentation ¶
Index ¶
- Constants
- Variables
- func FetchHostInfo(ctx context.Context, s *mcclient.ClientSession, id string) (*compute_api.HostDetails, error)
- func FetchServerInfo(ctx context.Context, s *mcclient.ClientSession, sid string) (*compute_api.ServerDetails, error)
- func ResolveHostSSHIPPortById(ctx context.Context, s *mcclient.ClientSession, id string, ip string, port int) (string, int, *compute_api.HostDetails, error)
- func ResolveServerSSHIPPortById(ctx context.Context, s *mcclient.ClientSession, id string, ip string, port int) (string, int, *compute_api.ServerDetails, error)
- type ISessionCommand
- type ISessionData
- type Pty
- type RandomSessionData
- type RemoteConsoleInfo
- func (info *RemoteConsoleInfo) Cleanup() error
- func (info *RemoteConsoleInfo) Connect() error
- func (info *RemoteConsoleInfo) GetClientSession() *mcclient.ClientSession
- func (info *RemoteConsoleInfo) GetCommand() *exec.Cmd
- func (info *RemoteConsoleInfo) GetConnectParams() (string, error)
- func (info *RemoteConsoleInfo) GetDisplayInfo(ctx context.Context) (*SDisplayInfo, error)
- func (info *RemoteConsoleInfo) GetId() string
- func (info *RemoteConsoleInfo) GetPassword() string
- func (info *RemoteConsoleInfo) GetProtocol() string
- func (info *RemoteConsoleInfo) GetRecordObject() *recorder.Object
- func (info *RemoteConsoleInfo) IsNeedLogin() (bool, error)
- func (info *RemoteConsoleInfo) Scan(byte, func(string))
- type RemoteRDPConsoleInfo
- func (info *RemoteRDPConsoleInfo) Cleanup() error
- func (info *RemoteRDPConsoleInfo) Connect() error
- func (info *RemoteRDPConsoleInfo) GetClientSession() *mcclient.ClientSession
- func (info *RemoteRDPConsoleInfo) GetCommand() *exec.Cmd
- func (info *RemoteRDPConsoleInfo) GetConnectParams() (string, error)
- func (info *RemoteRDPConsoleInfo) GetDisplayInfo(ctx context.Context) (*SDisplayInfo, error)
- func (info *RemoteRDPConsoleInfo) GetId() string
- func (info *RemoteRDPConsoleInfo) GetPassword() string
- func (info *RemoteRDPConsoleInfo) GetProtocol() string
- func (info *RemoteRDPConsoleInfo) GetRecordObject() *recorder.Object
- func (info *RemoteRDPConsoleInfo) IsNeedLogin() (bool, error)
- func (info *RemoteRDPConsoleInfo) Scan(byte, func(string))
- type SDisplayInfo
- type SSession
- type SSessionManager
- type SSshConnectionInfo
- type SSshSession
- func (s *SSshSession) Cleanup() error
- func (s *SSshSession) GetClientSession() *mcclient.ClientSession
- func (s *SSshSession) GetCommand() *exec.Cmd
- func (s *SSshSession) GetDisplayInfo(ctx context.Context) (*SDisplayInfo, error)
- func (s *SSshSession) GetId() string
- func (s *SSshSession) GetProtocol() string
- func (s *SSshSession) GetRecordObject() *recorder.Object
- func (s *SSshSession) IsNeedLogin() (bool, error)
- func (s *SSshSession) Scan(d byte, send func(msg string))
Constants ¶
View Source
const ( VNC = api.VNC RDP = api.RDP ALIYUN = api.ALIYUN QCLOUD = api.QCLOUD OPENSTACK = api.OPENSTACK SPICE = api.SPICE WMKS = api.WMKS WS = api.WS VMRC = api.VMRC ZSTACK = api.ZSTACK CTYUN = api.CTYUN HUAWEI = api.HUAWEI HCS = api.HCS APSARA = api.APSARA JDCLOUD = api.JDCLOUD CLOUDPODS = api.CLOUDPODS PROXMOX = api.PROXMOX VOLCENGINE = api.VOLC_ENGINE SANGFOR = api.SANGFOR )
Variables ¶
View Source
var ( Manager *SSessionManager AES_KEY string AccessInterval time.Duration = 5 * time.Minute )
Functions ¶
func FetchHostInfo ¶
func FetchHostInfo(ctx context.Context, s *mcclient.ClientSession, id string) (*compute_api.HostDetails, error)
func FetchServerInfo ¶
func FetchServerInfo(ctx context.Context, s *mcclient.ClientSession, sid string) (*compute_api.ServerDetails, error)
func ResolveHostSSHIPPortById ¶
func ResolveHostSSHIPPortById(ctx context.Context, s *mcclient.ClientSession, id string, ip string, port int) (string, int, *compute_api.HostDetails, error)
func ResolveServerSSHIPPortById ¶
func ResolveServerSSHIPPortById(ctx context.Context, s *mcclient.ClientSession, id string, ip string, port int) (string, int, *compute_api.ServerDetails, error)
Types ¶
type ISessionCommand ¶
type ISessionData ¶
type Pty ¶
type Pty struct { Session *SSession Cmd *exec.Cmd Pty *os.File OriginSize *pty.Winsize Exit bool // contains filtered or unexported fields }
func (*Pty) IsInShellMode ¶
type RandomSessionData ¶
func WrapCommandSession ¶
func WrapCommandSession(cmd command.ICommand) *RandomSessionData
func (*RandomSessionData) GetDisplayInfo ¶
func (s *RandomSessionData) GetDisplayInfo(ctx context.Context) (*SDisplayInfo, error)
func (*RandomSessionData) GetId ¶
func (s *RandomSessionData) GetId() string
func (*RandomSessionData) IsNeedLogin ¶
func (s *RandomSessionData) IsNeedLogin() (bool, error)
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) GetDisplayInfo ¶
func (info *RemoteConsoleInfo) GetDisplayInfo(ctx context.Context) (*SDisplayInfo, 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) IsNeedLogin ¶
func (info *RemoteConsoleInfo) IsNeedLogin() (bool, error)
IsNeedLogin implements ISessionData interface
func (*RemoteConsoleInfo) Scan ¶
func (info *RemoteConsoleInfo) Scan(byte, func(string))
Scan implements ISessionData interface
type RemoteRDPConsoleInfo ¶
type RemoteRDPConsoleInfo struct { Host string Port int Username string Password string ConnectionId string Width int Height int Dpi int // contains filtered or unexported fields }
func NewRemoteRDPConsoleInfoByCloud ¶
func NewRemoteRDPConsoleInfoByCloud(ctx context.Context, s *mcclient.ClientSession, serverId string, query jsonutils.JSONObject) (*RemoteRDPConsoleInfo, error)
func (*RemoteRDPConsoleInfo) Cleanup ¶
func (info *RemoteRDPConsoleInfo) Cleanup() error
func (*RemoteRDPConsoleInfo) Connect ¶
func (info *RemoteRDPConsoleInfo) Connect() error
func (*RemoteRDPConsoleInfo) GetClientSession ¶
func (info *RemoteRDPConsoleInfo) GetClientSession() *mcclient.ClientSession
func (*RemoteRDPConsoleInfo) GetCommand ¶
func (info *RemoteRDPConsoleInfo) GetCommand() *exec.Cmd
func (*RemoteRDPConsoleInfo) GetConnectParams ¶
func (info *RemoteRDPConsoleInfo) GetConnectParams() (string, error)
func (*RemoteRDPConsoleInfo) GetDisplayInfo ¶
func (info *RemoteRDPConsoleInfo) GetDisplayInfo(ctx context.Context) (*SDisplayInfo, error)
func (*RemoteRDPConsoleInfo) GetId ¶
func (info *RemoteRDPConsoleInfo) GetId() string
func (*RemoteRDPConsoleInfo) GetPassword ¶
func (info *RemoteRDPConsoleInfo) GetPassword() string
func (*RemoteRDPConsoleInfo) GetProtocol ¶
func (info *RemoteRDPConsoleInfo) GetProtocol() string
func (*RemoteRDPConsoleInfo) GetRecordObject ¶
func (info *RemoteRDPConsoleInfo) GetRecordObject() *recorder.Object
func (*RemoteRDPConsoleInfo) IsNeedLogin ¶
func (info *RemoteRDPConsoleInfo) IsNeedLogin() (bool, error)
func (*RemoteRDPConsoleInfo) Scan ¶
func (info *RemoteRDPConsoleInfo) Scan(byte, func(string))
type SDisplayInfo ¶
type SDisplayInfo struct { WaterMark string `json:"water_mark"` InstanceName string `json:"instance_name"` Ips string `json:"ips"` Hypervisor string `json:"hypervisor"` OsType string `json:"os_type"` OsName string `json:"os_name"` OsArch string `json:"os_arch"` OsDistribution string `json:"os_distribution"` SecretLevel string `json:"secret_level"` }
type SSession ¶
type SSession struct { ISessionData Id string AccessToken string AccessedAt time.Time // contains filtered or unexported fields }
func (*SSession) GetConnectParams ¶
func (*SSession) GetRecorder ¶
func (*SSession) RegisterDuplicateHook ¶
func (s *SSession) RegisterDuplicateHook(f func())
type SSessionManager ¶
func NewSessionManager ¶
func NewSessionManager() *SSessionManager
func (*SSessionManager) Save ¶
func (man *SSessionManager) Save(data ISessionData) (*SSession, error)
type SSshConnectionInfo ¶
type SSshConnectionInfo struct { IP string `json:"ip"` Port int `json:"port"` Username string `json:"username"` KeepUsername bool `json:"keep_username"` Password string `json:"password"` Name string `json:"name"` ResourceType string `json:"resource_type" choices:"host|server"` GuestDetails *compute_api.ServerDetails HostDetails *compute_api.HostDetails }
type SSshSession ¶
type SSshSession struct { Host string Port int PrivateKey string Username string // 保持原有 Username ,不实用 cloudroot 的同时使用 PrivateKey KeepUsername bool Password string // contains filtered or unexported fields }
func NewSshSession ¶
func NewSshSession(ctx context.Context, us *mcclient.ClientSession, conn SSshConnectionInfo) *SSshSession
func (*SSshSession) Cleanup ¶
func (s *SSshSession) Cleanup() error
func (*SSshSession) GetClientSession ¶
func (s *SSshSession) GetClientSession() *mcclient.ClientSession
func (*SSshSession) GetCommand ¶
func (s *SSshSession) GetCommand() *exec.Cmd
func (*SSshSession) GetDisplayInfo ¶
func (s *SSshSession) GetDisplayInfo(ctx context.Context) (*SDisplayInfo, error)
func (*SSshSession) GetId ¶
func (s *SSshSession) GetId() string
func (*SSshSession) GetProtocol ¶
func (s *SSshSession) GetProtocol() string
func (*SSshSession) GetRecordObject ¶
func (s *SSshSession) GetRecordObject() *recorder.Object
func (*SSshSession) IsNeedLogin ¶
func (s *SSshSession) IsNeedLogin() (bool, error)
func (*SSshSession) Scan ¶
func (s *SSshSession) Scan(d byte, send func(msg string))
Click to show internal directories.
Click to hide internal directories.