multiplex

package
v0.0.0-...-612934e Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const CloseMessage byte = 2
View Source
const DataMessage byte = 1

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

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

func NewConn

func NewConn(m *Multiplexer, id UUID) *Conn

func (*Conn) Close

func (c *Conn) Close() error

Close closes the connection.

func (*Conn) LocalAddr

func (c *Conn) LocalAddr() net.Addr

LocalAddr returns the local network address.

func (*Conn) Read

func (c *Conn) Read(b []byte) (n int, err error)

Read reads data from the connection.

func (*Conn) RemoteAddr

func (c *Conn) RemoteAddr() net.Addr

RemoteAddr returns the remote network address.

func (*Conn) SetDeadline

func (c *Conn) SetDeadline(t time.Time) error

SetDeadline sets the read and write deadlines associated with the connection. It is equivalent to calling both SetReadDeadline and SetWriteDeadline.

func (*Conn) SetReadDeadline

func (c *Conn) SetReadDeadline(t time.Time) error

SetReadDeadline sets the deadline for future Read calls.

func (*Conn) SetWriteDeadline

func (c *Conn) SetWriteDeadline(t time.Time) error

SetWriteDeadline sets the deadline for future Write calls.

func (*Conn) Write

func (c *Conn) Write(b []byte) (n int, err error)

Write writes data to the connection.

type Message

type Message struct {
	StreamID UUID
	Code     byte
	Data     []byte
}

func (*Message) Read

func (msg *Message) Read(r io.Reader) error

func (*Message) Write

func (msg *Message) Write(w io.Writer) (int, error)

type Multiplexer

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

func New

func New(conn net.Conn) *Multiplexer

func (*Multiplexer) Accept

func (m *Multiplexer) Accept() (c net.Conn, err error)

Accept waits for and returns the next connection to the listener.

func (*Multiplexer) Addr

func (m *Multiplexer) Addr() net.Addr

Addr returns the listener's network address.

func (*Multiplexer) Close

func (m *Multiplexer) Close() error

Close closes the listener. Any blocked Accept operations will be unblocked and return errors.

func (*Multiplexer) Open

func (m *Multiplexer) Open() (c net.Conn, err error)

Create a new stream

func (*Multiplexer) Write

func (m *Multiplexer) Write(msg Message) (int, error)

type UUID

type UUID [24]byte

func (UUID) String

func (uuid UUID) String() string

Jump to

Keyboard shortcuts

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