Help us shape the future of Go! Take the 2026 Go Developer Survey

protocol

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2026 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CompressedFlag byte = 0x01 // Message is compressed
	EndStreamFlag  byte = 0x02 // Final message in stream
)

Envelope protocol flags

Variables

This section is empty.

Functions

func CreateEnvelope

func CreateEnvelope(flags byte, data []byte) []byte

CreateEnvelope creates an envelope with the given flags and data.

func WriteEnvelope

func WriteEnvelope(w io.Writer, flags byte, data []byte) error

WriteEnvelope writes an envelope to an io.Writer.

Types

type Envelope

type Envelope struct {
	Flags  byte
	Length uint32
	Data   []byte
}

Envelope represents a ConnectRPC envelope message with flags and data. Format: [1 byte flags][4 bytes length][N bytes data]

func ParseEnvelope

func ParseEnvelope(data []byte) (*Envelope, []byte, error)

ParseEnvelope reads an envelope from the provided data. Returns the parsed envelope and any remaining unconsumed data.

func ReadEnvelope

func ReadEnvelope(r io.Reader) (*Envelope, error)

ReadEnvelope reads a single envelope from an io.Reader.

func (*Envelope) IsCompressed

func (e *Envelope) IsCompressed() bool

IsCompressed checks if the envelope has the Compressed flag set.

func (*Envelope) IsEndStream

func (e *Envelope) IsEndStream() bool

IsEndStream checks if the envelope has the EndStream flag set.

Jump to

Keyboard shortcuts

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