frame

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConnectionCloseApplication = iota
	ConnectionCloseGraceful
	ConnectionCloseTimeout
	ConnectionCloseInternal
)
View Source
const (
	ConnectionResponseSuccess = iota
	ConnectionResponseFailed
)
View Source
const (
	IDAcknowledgement = iota

	IDConnectionRequest
	IDConnectionResponse
	IDConnectionClose

	IDStreamRequest
	IDStreamResponse
	IDStreamData
	IDStreamClose

	IDMTURequest
	IDMTUResponse
)
View Source
const (
	StreamResponseSuccess = iota
	StreamResponseFailed
)

Variables

View Source
var (
	Pool = sync.Pool{
		New: func() any {
			return make([]Frame, 0, 64)
		},
	}
)

Functions

func Pack

func Pack(connectionID protocol.ConnectionID, sequenceID uint32, total uint32, frames []byte) []byte

func PackSingle

func PackSingle(fr Frame) []byte

func PutFrame

func PutFrame(fr Frame)

Types

type Acknowledgement

type Acknowledgement struct {
	Delay  int64
	Max    uint32
	Ranges []AcknowledgementRange
}

func (*Acknowledgement) Decode

func (fr *Acknowledgement) Decode(p []byte) (int, error)

func (*Acknowledgement) Encode

func (fr *Acknowledgement) Encode() []byte

func (*Acknowledgement) ID

func (fr *Acknowledgement) ID() uint32

func (*Acknowledgement) Reset

func (fr *Acknowledgement) Reset()

type AcknowledgementRange

type AcknowledgementRange [2]uint32

func GenerateAcknowledgementRanges added in v0.0.3

func GenerateAcknowledgementRanges(list []uint32) (ranges []AcknowledgementRange)

type ConnectionClose

type ConnectionClose struct {
	Code    byte
	Message string
}

func (*ConnectionClose) Decode

func (fr *ConnectionClose) Decode(p []byte) (int, error)

func (*ConnectionClose) Encode

func (fr *ConnectionClose) Encode() []byte

func (*ConnectionClose) ID

func (fr *ConnectionClose) ID() uint32

func (*ConnectionClose) Reset added in v0.0.3

func (fr *ConnectionClose) Reset()

type ConnectionRequest

type ConnectionRequest struct {
}

func (*ConnectionRequest) Decode

func (fr *ConnectionRequest) Decode(_ []byte) (n int, err error)

func (*ConnectionRequest) Encode

func (fr *ConnectionRequest) Encode() (n []byte)

func (*ConnectionRequest) ID

func (fr *ConnectionRequest) ID() uint32

func (*ConnectionRequest) Reset added in v0.0.3

func (fr *ConnectionRequest) Reset()

type ConnectionResponse

type ConnectionResponse struct {
	ConnectionID protocol.ConnectionID
	Response     byte
}

func (*ConnectionResponse) Decode

func (fr *ConnectionResponse) Decode(p []byte) (int, error)

func (*ConnectionResponse) Encode

func (fr *ConnectionResponse) Encode() []byte

func (*ConnectionResponse) ID

func (fr *ConnectionResponse) ID() uint32

func (*ConnectionResponse) Reset added in v0.0.3

func (fr *ConnectionResponse) Reset()

type Frame

type Frame interface {
	ID() uint32
	Encode() []byte
	Decode(p []byte) (int, error)
	Reset()
}

func GetFrame

func GetFrame(id uint32) (Frame, error)

func Unpack

func Unpack(p []byte) (connectionID protocol.ConnectionID, sequenceID uint32, frames []Frame, err error)

type MTURequest added in v0.0.3

type MTURequest struct {
	MTU uint64
}

func (*MTURequest) Decode added in v0.0.3

func (fr *MTURequest) Decode(p []byte) (int, error)

func (*MTURequest) Encode added in v0.0.3

func (fr *MTURequest) Encode() []byte

func (*MTURequest) ID added in v0.0.3

func (fr *MTURequest) ID() uint32

func (*MTURequest) Reset added in v0.0.3

func (fr *MTURequest) Reset()

type MTUResponse added in v0.0.3

type MTUResponse struct {
	MTU uint64
}

func (*MTUResponse) Decode added in v0.0.3

func (fr *MTUResponse) Decode(p []byte) (int, error)

func (*MTUResponse) Encode added in v0.0.3

func (fr *MTUResponse) Encode() []byte

func (*MTUResponse) ID added in v0.0.3

func (fr *MTUResponse) ID() uint32

func (*MTUResponse) Reset added in v0.0.3

func (fr *MTUResponse) Reset()

type StreamClose

type StreamClose struct {
	StreamID protocol.StreamID
}

func (*StreamClose) Decode

func (fr *StreamClose) Decode(p []byte) (int, error)

func (*StreamClose) Encode

func (fr *StreamClose) Encode() []byte

func (*StreamClose) ID

func (fr *StreamClose) ID() uint32

func (*StreamClose) Reset added in v0.0.3

func (fr *StreamClose) Reset()

type StreamData

type StreamData struct {
	StreamID   protocol.StreamID
	SequenceID uint32
	Payload    []byte
}

func (*StreamData) Decode

func (fr *StreamData) Decode(p []byte) (int, error)

func (*StreamData) Encode

func (fr *StreamData) Encode() []byte

func (*StreamData) ID

func (fr *StreamData) ID() uint32

func (*StreamData) Reset

func (fr *StreamData) Reset()

type StreamRequest

type StreamRequest struct {
	StreamID protocol.StreamID
}

func (*StreamRequest) Decode

func (fr *StreamRequest) Decode(p []byte) (int, error)

func (*StreamRequest) Encode

func (fr *StreamRequest) Encode() []byte

func (*StreamRequest) ID

func (fr *StreamRequest) ID() uint32

func (*StreamRequest) Reset added in v0.0.3

func (fr *StreamRequest) Reset()

type StreamResponse

type StreamResponse struct {
	StreamID protocol.StreamID
	Response byte
}

func (*StreamResponse) Decode

func (fr *StreamResponse) Decode(p []byte) (int, error)

func (*StreamResponse) Encode

func (fr *StreamResponse) Encode() []byte

func (*StreamResponse) ID

func (fr *StreamResponse) ID() uint32

func (*StreamResponse) Reset added in v0.0.3

func (fr *StreamResponse) Reset()

Jump to

Keyboard shortcuts

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