client

package module
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2022 License: MIT Imports: 5 Imported by: 0

README

client

This repository is for the go-based client library.

Tests License

Go Library

GoDoc Go Report Card

go get github.com/altid/client

Documentation

Index

Constants

View Source
const MSIZE = p.MSIZE

MSIZE - maximum size for a message

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client represents a 9p client session

func NewClient

func NewClient(addr, port string) *Client

NewClient returns a client ready to connect to addr:port

func NewMockClient

func NewMockClient(addr string) *Client

NewMockClient returns a client for testing Feed, if called, will be populated with data from google's GoFuzz every 100ms

func (*Client) Aside

func (c *Client) Aside() ([]byte, error)

Aside returns the contents of the `aside` file for a given buffer

func (*Client) Attach

func (c *Client) Attach() (err error)

Attach is called after optionally calling Auth

func (*Client) Auth

func (c *Client) Auth() error

Auth is optionally called after Connect to authenticate with the server

func (*Client) Buffer

func (c *Client) Buffer(name string) (int, error)

Buffer changes the active buffer to the named buffer, or returns an error

func (*Client) Cleanup

func (c *Client) Cleanup()

Cleanup closes the underlying connection

func (*Client) Close

func (c *Client) Close(name string) (int, error)

Close attempts to close the named buffer

func (*Client) Command

func (c *Client) Command(cmd *commander.Command) (int, error)

Command sends the named command to the service If command is invalid, it will return an error

func (*Client) Connect

func (c *Client) Connect(debug bool) (err error)

Connect performs the network dial for the connection

func (*Client) Ctl

func (c *Client) Ctl() ([]byte, error)

Ctl returns the contents of the `ctl` file for a given service

func (*Client) Document

func (c *Client) Document() ([]byte, error)

Document returns the contents of a document file on the host if it exists, or an error

func (*Client) Feed

func (c *Client) Feed() (io.ReadCloser, error)

Feed returns a ReadCloser connected to `feed`. It's expected all reads will be read into a buffer with a size of MSIZE It is also expected for Feed to be called in its own thread

func (*Client) FeedIterator

func (c *Client) FeedIterator() (*FeedIterator, error)

FeedIterator returns a new FeedIterator ready to go

func (*Client) GetCommands

func (c *Client) GetCommands() ([]*commander.Command, error)

GetCommands initializes c.CmdList

func (*Client) Input

func (c *Client) Input(data []byte) (int, error)

Input appends the given data string to input

func (c *Client) Link(name string) (int, error)

Link updates the current buffer to the named buffer, closing the former

func (*Client) Notifications

func (c *Client) Notifications() ([]byte, error)

Notifications returns and clears any pending notifications

func (*Client) Open

func (c *Client) Open(name string) (int, error)

Open attempts to open the named buffer

func (*Client) Send

func (c *Client) Send(cmd *commander.Command, args []string) (int, error)

Send a named command with optional args to the service

func (*Client) Status

func (c *Client) Status() ([]byte, error)

Status returns the contents of the `status` file for a given buffer

func (*Client) Tabs

func (c *Client) Tabs() ([]byte, error)

Tabs returns the contents of the `tabs` file for the server

func (*Client) Title

func (c *Client) Title() ([]byte, error)

Title returns the contents of the `title` file for a given buffer

type FeedIterator

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

FeedIterator allows you to step through lines of feed with Next() Useful for gomobile, etc

func (*FeedIterator) Next

func (f *FeedIterator) Next() ([]byte, error)

Next will return the next slice of bytes, or an error After an error, future calls to Next() will panic

Directories

Path Synopsis
cmd
test_client command

Jump to

Keyboard shortcuts

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