Documentation ¶
Overview ¶
Package frames is a simple multiplexing protocol.
Index ¶
Constants ¶
View Source
const ( // FrameOpen is a command to open a channel on a connection. FrameOpen = FrameCmd(iota) // FrameClose is a command to close a channel on a connection. FrameClose // FrameData is a command indicating the packet contains data. FrameData )
View Source
const ( // FrameSuccess is the status indicating a successful command. FrameSuccess = FrameStatus(iota) // FrameError is the status indicating a failed command. FrameError )
Variables ¶
View Source
var ErrChannelsExhausted = errors.New("channels exhausted")
ErrChannelsExhausted is returned when we've run out of channels.
Functions ¶
Types ¶
type ChannelDialer ¶
ChannelDialer is the client interface from which one builds connections.
func NewClient ¶
func NewClient(c net.Conn) ChannelDialer
NewClient converts a socket into a channel dialer.
type FramePacket ¶
type FramePacket struct { // The command Cmd FrameCmd // Status int Status FrameStatus // Channel over which the command should be sent. Channel uint16 // Extra data for the command. Data []byte // contains filtered or unexported fields }
A FramePacket is a packet sent or received over a connection.
func PacketFromHeader ¶
func PacketFromHeader(hdr []byte) FramePacket
PacketFromHeader constructs a packet from the given header.
func (FramePacket) Bytes ¶
func (fp FramePacket) Bytes() []byte
Bytes converts this packet to its network representation.
func (FramePacket) String ¶
func (fp FramePacket) String() string
type FrameStatus ¶
type FrameStatus uint8
FrameStatus represents a command status.
func (FrameStatus) String ¶
func (c FrameStatus) String() string
Click to show internal directories.
Click to hide internal directories.