asciitransport

package
v0.1.15 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2024 License: MIT Imports: 7 Imported by: 0

README

net.Conn

asciitransport /
client <-> server


client.Read => Frame{Output} <= server.Write client.Write => Frame{Input,Resize} <= server.Read


client << Output << server client >> Input/Resize >> server


os.Stdout client << Output << server term.Read []byte os.Stdin client >> Input

server term.Write []byte term.winch client >> Resize >> server term.Resize uint32

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func I

func I(b []byte) *asciiproto.Frame

func O

func O(b []byte) *asciiproto.Frame

func R

func R(w, h uint16) *asciiproto.Frame

func Uh

func Uh(r uint32) uint16

func Uw

func Uw(r uint32) uint16

Types

type AsciiTransport

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

func (*AsciiTransport) Close

func (c *AsciiTransport) Close() error

func (*AsciiTransport) Done

func (c *AsciiTransport) Done() <-chan struct{}

func (*AsciiTransport) Read

func (at *AsciiTransport) Read() (*asciiproto.Frame, error)

Read Unmarshal

func (*AsciiTransport) Write

func (at *AsciiTransport) Write(f *asciiproto.Frame) error

Write Marshal

type AsciiTransportClient

type AsciiTransportClient struct {
	*AsciiTransport
}

func Client

func Client(conn io.ReadWriteCloser, opts ...Opt) *AsciiTransportClient

func (*AsciiTransportClient) Input

func (c *AsciiTransportClient) Input(buf []byte)

func (*AsciiTransportClient) InputFrom

func (c *AsciiTransportClient) InputFrom(r io.Reader) error

func (*AsciiTransportClient) ReadLoop

func (c *AsciiTransportClient) ReadLoop()

func (*AsciiTransportClient) Resize

func (c *AsciiTransportClient) Resize(height, width uint16)

type AsciiTransportServer

type AsciiTransportServer struct {
	*AsciiTransport
}

func Server

func Server(conn io.ReadWriteCloser, opts ...Opt) *AsciiTransportServer

func (*AsciiTransportServer) Output

func (c *AsciiTransportServer) Output(buf []byte)

func (*AsciiTransportServer) OutputFrom

func (c *AsciiTransportServer) OutputFrom(r io.Reader) error

func (*AsciiTransportServer) ReadLoop

func (c *AsciiTransportServer) ReadLoop()

type Logger

type Logger interface {
	Log(*asciiproto.Frame)
	Close() error
}

func NewLogger

func NewLogger(w io.WriteCloser) Logger

type Opt

type Opt func(at *AsciiTransport)

func WithLogger

func WithLogger(w io.WriteCloser) Opt

func WithReader

func WithReader(r io.Reader) Opt

func WithResizeHook

func WithResizeHook(rh func(_, _ uint16)) Opt

func WithWriter

func WithWriter(w io.Writer) Opt

Jump to

Keyboard shortcuts

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