session

package
v0.0.0-...-d817ec6 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Copyright 2019-2020 Axetroy. All rights reserved. Apache License 2.0.

Copyright 2019-2020 Axetroy. All rights reserved. Apache License 2.0.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Test

func Test(config Config) bool

测试服务器是否可用

Types

type Config

type Config struct {
	Username   string
	Host       string
	Port       uint
	Password   string // 用密码连接
	PrivateKey string // 用私钥连接,如果设置了私钥,优先使用私钥连接
	Width      int    // pty width
	Height     int    // pty height
}

type Meta

type Meta struct {
	Uid    string
	Ip     string
	HostID string
}

type Terminal

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

func NewTerminal

func NewTerminal(config Config) (*Terminal, error)

func (*Terminal) Close

func (t *Terminal) Close() (err error)

func (*Terminal) Connect

func (t *Terminal) Connect(stdin io.Reader, stdout io.Writer, stderr io.Writer) error

func (*Terminal) IsClosed

func (t *Terminal) IsClosed() bool

终端是否已断臂

func (*Terminal) SetCloseHandler

func (t *Terminal) SetCloseHandler(h func() error)

type WebsocketStream

type WebsocketStream struct {
	sync.RWMutex

	CreatedAt time.Time // 创建时间
	UpdatedAt time.Time // 最新的更新时间
	Meta      Meta      // 元信息
	// contains filtered or unexported fields
}

func NewWebSocketSteam

func NewWebSocketSteam(connection *websocket.Conn, meta Meta) *WebsocketStream

func (*WebsocketStream) Read

func (r *WebsocketStream) Read(p []byte) (n int, err error)

func (*WebsocketStream) Write

func (r *WebsocketStream) Write(p []byte) (n int, err error)

func (*WebsocketStream) Write2Log

func (r *WebsocketStream) Write2Log() error

Jump to

Keyboard shortcuts

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