Versions in this module Expand all Collapse all v0 v0.2.0 May 19, 2026 v0.1.0 May 17, 2026 Changes in this version + const HandshakeSize + const HeaderSize + const ProtocolVersion + var ErrBufferTooSmall = errors.New("protocol: buffer too small (need 64 bytes)") + var ErrHandshakeBufTooSmall = errors.New("protocol: handshake buffer too small (need 128 bytes)") + var ErrHandshakeInvalidMagic = errors.New("protocol: handshake invalid magic (expected 0x434F4D50)") + var ErrInvalidMagic = errors.New("protocol: invalid magic (expected 0x434F4D50)") + var ErrRejected = errors.New("protocol: connection rejected by compositor") + var ErrUnknownMsgType = errors.New("protocol: unknown message type") + var Magic = [4]byte + func Encode(h *Header, buf []byte) error + func EncodeHello(msg *HelloMsg, buf []byte) error + func EncodeWelcome(msg *WelcomeMsg, buf []byte) error + func GetName(msg *HelloMsg) string + func SetName(msg *HelloMsg, name string) + type Compression uint8 + const CompressionLZ4 + const CompressionNone + const CompressionZstd + func (c Compression) String() string + func (c Compression) Valid() bool + type Flag uint8 + const FlagCompressed + const FlagDirtyValid + const FlagKeyframe + func (f Flag) Clear(flag Flag) Flag + func (f Flag) Has(flag Flag) bool + func (f Flag) Set(flag Flag) Flag + func (f Flag) String() string + type Header struct + Compression Compression + DirtyH uint16 + DirtyW uint16 + DirtyX uint16 + DirtyY uint16 + Flags Flag + Height uint16 + Magic [4]byte + ModuleID uint64 + MsgType MsgType + PayloadSize uint32 + PixelFormat PixelFormat + Reserved [6]byte + Sequence uint64 + Stride uint32 + TimestampNs int64 + UncompressedSize uint32 + Version uint16 + Width uint16 + func Decode(buf []byte) (Header, error) + type HelloMsg struct + Height uint16 + Magic [4]byte + Name [64]byte + PreferredFPS uint16 + Reserved [51]byte + Transport TransportType + Version uint16 + Width uint16 + func DecodeHello(buf []byte) (HelloMsg, error) + type MsgType uint8 + const MsgAck + const MsgDisconnect + const MsgFrame + const MsgFrameRequest + const MsgHandshake + const MsgResize + func (m MsgType) String() string + func (m MsgType) Valid() bool + type PixelFormat uint8 + const PixelBGRA8 + const PixelRGBA8 + func (p PixelFormat) String() string + func (p PixelFormat) Valid() bool + type TransportType uint8 + const TransportShm + const TransportSocket + func (t TransportType) String() string + type WelcomeMsg struct + Accepted uint8 + Magic [4]byte + MaxVersion uint16 + MinVersion uint16 + ModuleID uint64 + Reserved [108]byte + Transport TransportType + Version uint16 + func DecodeWelcome(buf []byte) (WelcomeMsg, error)