remotecommand

package
v0.6.4-alpha.0 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2024 License: MPL-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Maximum message size allowed from peer.
	MaxMessageSize = 2 << 14
)
View Source
const (
	PingWaitDuration = 60 * time.Second
)

Variables

This section is empty.

Functions

func ExecuteConn

func ExecuteConn(ctx context.Context, rawConn *websocket.Conn, stdin io.Reader, stdout io.Writer, stderr io.Writer, log log.Logger) (int, error)

func Ping

func Ping(ctx context.Context, ws *WebsocketConn)

Types

type Message

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

func NewExitCodeMessage

func NewExitCodeMessage(exitCode int) *Message

func ParseMessage

func ParseMessage(reader io.Reader) (*Message, error)

func (*Message) Bytes

func (m *Message) Bytes() []byte

type MessageType

type MessageType byte
const (
	StdoutData  MessageType = 0
	StdoutClose MessageType = 1
	StderrData  MessageType = 2
	StderrClose MessageType = 3
	StdinData   MessageType = 4
	StdinClose  MessageType = 5
	ExitCode    MessageType = 6
)

type Stream

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

func NewStream

func NewStream(ws *WebsocketConn, dataType, closeType MessageType) *Stream

func (*Stream) Read

func (s *Stream) Read(reader io.Reader) error

func (*Stream) Write

func (s *Stream) Write(ctx context.Context, writer io.WriteCloser) error

type WebsocketConn

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

func NewWebsocketConn

func NewWebsocketConn(ws *websocket.Conn) *WebsocketConn

func (*WebsocketConn) Close

func (w *WebsocketConn) Close() error

func (*WebsocketConn) ReadMessage

func (w *WebsocketConn) ReadMessage() (messageType int, p []byte, err error)

func (*WebsocketConn) WriteControl

func (w *WebsocketConn) WriteControl(messageType int, data []byte, deadline time.Time) error

func (*WebsocketConn) WriteMessage

func (w *WebsocketConn) WriteMessage(messageType int, data []byte) error

Jump to

Keyboard shortcuts

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