robocat

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2023 License: MIT Imports: 19 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func Connect added in v0.1.2

func Connect(u string, credentials ...Credentials) (*Client, error)

func (*Client) Close

func (c *Client) Close() error

func (*Client) Flow

func (c *Client) Flow(flow string) *FlowCommandChain

func (*Client) Input

func (c *Client) Input(path string, content []byte) error

func (*Client) Ping

func (c *Client) Ping() error

func (*Client) SetLogger added in v0.1.10

func (c *Client) SetLogger(logger *Logger)

func (*Client) SetSizeLimit added in v0.1.3

func (c *Client) SetSizeLimit(limit string) error

Nax number of bytes to read for a single message. Limit must be in human-readable format (i.e. 10M, 50KB, etc) - for more details refer to https://pkg.go.dev/github.com/docker/go-units@v0.5.0#section-documentation

func (*Client) Stop

func (c *Client) Stop() error

type Credentials

type Credentials struct {
	Username string
	Password string
}

func (*Credentials) GetUserInfo

func (c *Credentials) GetUserInfo() *url.Userinfo

type File added in v0.1.2

type File struct {
	Path     string
	MimeType string
	Payload  []byte
}

func (*File) Image added in v0.1.2

func (f *File) Image() (image.Image, string, error)

Uses image.Decode to decode an image that has been encoded in a registered format. The string returned is the format name.

func (*File) Kind added in v0.1.2

func (f *File) Kind() string

Generic file kind extracted from MIME-type (i.e. text, image, etc).

func (*File) Text added in v0.1.2

func (f *File) Text() string

Converts transmitted payload to plain text and returns it as string.

func (*File) Type added in v0.1.2

func (f *File) Type() string

Complete MIME-type as provided by mime.ParseMediaType.

type FlowCommandChain

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

func (*FlowCommandChain) Run

func (chain *FlowCommandChain) Run() *RobocatFlow

func (*FlowCommandChain) WithData

func (chain *FlowCommandChain) WithData(data string) *FlowCommandChain

func (*FlowCommandChain) WithProxy

func (chain *FlowCommandChain) WithProxy(proxy string) *FlowCommandChain

func (*FlowCommandChain) WithTimeout

func (chain *FlowCommandChain) WithTimeout(timeout time.Duration) *FlowCommandChain

type Logger added in v0.1.10

type Logger struct {
	Debug func(args ...any)
	Error func(args ...any)
}

type RobocatFileStream

type RobocatFileStream struct {
	RobocatStream[*File]
}

type RobocatFlow

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

func (*RobocatFlow) Done

func (f *RobocatFlow) Done() <-chan struct{}

func (*RobocatFlow) Err

func (f *RobocatFlow) Err() error

func (*RobocatFlow) Files

func (f *RobocatFlow) Files() *RobocatFileStream

func (*RobocatFlow) Log

func (f *RobocatFlow) Log() *RobocatLogStream

func (*RobocatFlow) Wait

func (f *RobocatFlow) Wait() error

type RobocatInput

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

func (*RobocatInput) Push

func (i *RobocatInput) Push(
	path string,
	mimeType string,
	content []byte,
) error

type RobocatLogStream

type RobocatLogStream struct {
	RobocatStream[string]
}

type RobocatStream

type RobocatStream[T any] struct {
	// contains filtered or unexported fields
}

func (*RobocatStream[T]) Channel

func (s *RobocatStream[T]) Channel() <-chan T

Get read-only channel with stream items.

func (*RobocatStream[T]) Close

func (s *RobocatStream[T]) Close()

Mark stream as closed.

func (*RobocatStream[T]) Push

func (s *RobocatStream[T]) Push(item T) error

Append a new item to the stream.

func (*RobocatStream[T]) Watch

func (s *RobocatStream[T]) Watch(callback func(item T))

type UpdateCallback

type UpdateCallback func(context.Context, *ws.Message)

Jump to

Keyboard shortcuts

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