transceiver

package
v0.0.0-...-cbcbf1e Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2024 License: GPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Stream

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

Stream is a buffered I/O channel.

func NewStream

func NewStream(channel io.ReadWriteCloser, bufSize int) *Stream

NewStream returns a new buffered I/O channel. channel is an underlying I/O channel that implements io.ReadWriteCloser.

func (*Stream) Close

func (r *Stream) Close() error

Close is a wrapper function of net.Conn.Close().

func (*Stream) GetReadTimeout

func (r *Stream) GetReadTimeout() time.Duration

func (*Stream) GetWriteTimeout

func (r *Stream) GetWriteTimeout() time.Duration

func (*Stream) LastRead

func (r *Stream) LastRead() time.Time

LastRead returns the timestamp of the last successful read operation except Peek().

func (*Stream) LastWrite

func (r *Stream) LastWrite() time.Time

LastWrite returns the timestamp of the last successful write operation.

func (*Stream) Peek

func (r *Stream) Peek(n int) ([]byte, error)

Peek is a wrapper function of bufio.Reader.Peek().

func (*Stream) Read

func (r *Stream) Read(p []byte) (n int, err error)

Read is a wrapper function of bufio.Reader.Read().

func (*Stream) ReadN

func (r *Stream) ReadN(n int) (p []byte, err error)

ReadN reads exactly n bytes from the underlying socket. It returns non-nil error if len(p) < n, and the data, whose length is len(p) bytes long, still remains in the socket buffer.

func (*Stream) RemoteAddr

func (r *Stream) RemoteAddr() net.Addr

func (*Stream) SetReadTimeout

func (r *Stream) SetReadTimeout(t time.Duration)

SetReadTimeout sets read timeout of the underlying socket if it implements deadline interface.

func (*Stream) SetWriteTimeout

func (r *Stream) SetWriteTimeout(t time.Duration)

SetWriteTimeout sets write timeout of the underlying socket if it implements deadline interface.

func (*Stream) Write

func (r *Stream) Write(p []byte) (n int, err error)

Write is a wrapper function of net.Conn.Write().

type Transceiver

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

func NewTransceiver

func NewTransceiver(stream *Stream, handler Handler) *Transceiver

func (*Transceiver) Close

func (r *Transceiver) Close() error

func (*Transceiver) Run

func (r *Transceiver) Run(ctx context.Context) error

func (*Transceiver) Version

func (r *Transceiver) Version() (negotiated bool, version uint8)

func (*Transceiver) Write

func (r *Transceiver) Write(msg encoding.BinaryMarshaler) error

type WriteCloser

type WriteCloser interface {
	Writer
	Close() error
}

type Writer

type Writer interface {
	Write(msg encoding.BinaryMarshaler) error
}

Jump to

Keyboard shortcuts

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