protocol

package
v0.0.0-...-a0c0297 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CommandBufferSize = 100
)

Variables

View Source
var (
	ErrCommandNotFound       = errors.New("command not found")
	ErrCommandBufferExceeded = errors.New("command buffer length exceeded")
	ErrSocketClosed          = errors.New("socket closed")
	ErrCanNotExecute         = errors.New("can not execute this command")
)

Functions

func ReadCmd

func ReadCmd(ctx context.Context, buffer chan byte, maxLength int) (string, error)

Types

type Metadata

type Metadata struct {
	Name        string
	Description string
}

type ModeCommand

type ModeCommand struct {
}

func (*ModeCommand) Metadata

func (c *ModeCommand) Metadata() Metadata

func (*ModeCommand) Run

func (c *ModeCommand) Run(proto *Protocol) error

type Protocol

type Protocol struct {
	Providers         []Provider
	Stream            io.ReadWriteCloser
	BufferBacklogSize int
	BufferSize        int
	Interactive       bool
	// contains filtered or unexported fields
}

func (*Protocol) Close

func (p *Protocol) Close()

func (*Protocol) Error

func (p *Protocol) Error(err error)

func (*Protocol) Run

func (p *Protocol) Run(ctx context.Context)

func (*Protocol) Write

func (p *Protocol) Write(data []byte) (int, error)

type Provider

type Provider interface {
	Execute(cmd string, protocol *Protocol) error
	CanExecute(cmd string, protocol *Protocol) bool
	List() []Metadata
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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