terminal

package
v0.2.9 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2021 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrPodK8sGet         = errors.New("容器获取失败,该容器可能不存在")
	ErrSessionIdGenerate = errors.New("SessionId 生成失败,请刷新页面重试")
)

Functions

func MakeHandler

func MakeHandler(svc Service, logger kitlog.Logger, repository repository.Repository) http.Handler

func NewParser

func NewParser(keyFunc jwt.Keyfunc, method jwt.SigningMethod, newClaims kitjwt.ClaimsFactory) endpoint.Middleware

func WaitForTerminal

func WaitForTerminal(k8sClient *k8s.Clientset, cfg *rest.Config, ts TerminalSession, namespace, pod, container, cmd string)

Types

type IndexData

type IndexData struct {
	Namespace    string
	PodName      string
	Container    string
	ErrMsg       string
	SessionId    string
	Token        string
	BashStr      string
	TemplateFile string
}

type PtyHandler

type PtyHandler interface {
	io.Reader
	io.Writer
	remotecommand.TerminalSizeQueue
}

type Service

type Service interface {
	//Attach(ctx context.Context, path string) http.Handler
	// 终端控制台页面
	Index(ctx context.Context, podName, container string) (*IndexData, error)

	// 处理客户端发来的ws建立请求
	HandleTerminalSession(session sockjs.Session)
}

func NewLoggingService

func NewLoggingService(logger log.Logger, s Service) Service

func NewService

func NewService(logger log.Logger, config *config.Config, k8sClient kubernetes.K8sClient) Service

type TerminalMessage

type TerminalMessage struct {
	Op, Data, SessionID string
	Rows, Cols          uint16
}

type TerminalResult

type TerminalResult struct {
	SessionId string `json:"sessionId,omitempty"`
	Token     string `json:"token,omitempty"`
	Cluster   string `json:"cluster,omitempty"`
	Namespace string `json:"namespace,omitempty"`
	Pod       string `json:"pod,omitempty"`
	Container string `json:"container,omitempty"`
	Cmd       string `json:"cmd,omitempty"`
}

type TerminalSession

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

func (TerminalSession) Close

func (t TerminalSession) Close(status uint32, reason string)

func (TerminalSession) Next

func (TerminalSession) Read

func (t TerminalSession) Read(p []byte) (int, error)

func (TerminalSession) Write

func (t TerminalSession) Write(p []byte) (int, error)

Jump to

Keyboard shortcuts

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