muxer

package
v0.13.3 Latest Latest
Warning

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

Go to latest
Published: May 5, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Magic number chosen to represent unknown protocols
	PROTOCOL_UNKNOWN uint16 = 0xabcd

	// Handshake protocol ID
	PROTOCOL_HANDSHAKE = 0
)
View Source
const (
	SEGMENT_PROTOCOL_ID_RESPONSE_FLAG = 0x8000
	SEGMENT_MAX_PAYLOAD_LENGTH        = 65535
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Muxer

type Muxer struct {
	ErrorChan chan error
	// contains filtered or unexported fields
}

func New

func New(conn net.Conn) *Muxer

func (*Muxer) RegisterProtocol

func (m *Muxer) RegisterProtocol(protocolId uint16) (chan *Segment, chan *Segment)

func (*Muxer) Send

func (m *Muxer) Send(msg *Segment) error

func (*Muxer) Start added in v0.10.1

func (m *Muxer) Start()

func (*Muxer) Stop added in v0.13.1

func (m *Muxer) Stop()

type Segment added in v0.5.0

type Segment struct {
	SegmentHeader
	Payload []byte
}

func NewSegment added in v0.5.0

func NewSegment(protocolId uint16, payload []byte, isResponse bool) *Segment

type SegmentHeader added in v0.5.0

type SegmentHeader struct {
	Timestamp     uint32
	ProtocolId    uint16
	PayloadLength uint16
}

func (*SegmentHeader) GetProtocolId added in v0.5.0

func (s *SegmentHeader) GetProtocolId() uint16

func (*SegmentHeader) IsRequest added in v0.5.0

func (s *SegmentHeader) IsRequest() bool

func (*SegmentHeader) IsResponse added in v0.5.0

func (s *SegmentHeader) IsResponse() bool

Jump to

Keyboard shortcuts

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