streamwire

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package streamwire defines experimental USB-only EPS1 records. CRC detects corruption, not forgery. Never expose this framing as authenticated Wi-Fi.

Index

Constants

View Source
const HeaderSize = 32
View Source
const MaxPayload = 100
View Source
const MaxRecord = HeaderSize + MaxPayload

Variables

View Source
var ErrRecord = errors.New("stream wire: invalid record")

Functions

func Encode

func Encode(dst []byte, r Record) (int, error)

Encode borrows Payload. Decode aliases its input; consume before reusing it.

func Send

func Send(stream io.ReadWriter, epoch uint64, frame display.Frame) error

Send borrows an immutable server-side frame. The stream must impose I/O deadlines. A failure is not automatically retried: completion may be unknown. Epoch is a fresh nonzero host random value for this physical USB session.

func Size

func Size(header []byte) (int, error)

Types

type Kind

type Kind uint8
const (
	Hello Kind = iota + 1
	Begin
	Data
	Commit
	Query
	Abort
	Reply
)
type Link struct {
	// contains filtered or unexported fields
}

Link is owned by one USB loop and retained across disconnects so reconnect cannot bypass refresh cadence. Call Tick even without incoming bytes.

func NewLink(config streamrx.Config, sink streamrx.Sink, interval time.Duration) (*Link, error)

func (*Link) Disconnect

func (l *Link) Disconnect() error

func (*Link) Push

func (l *Link) Push(src []byte, now time.Duration, write func([]byte) error) error

Push accepts arbitrary fragmentation but sends one reply per complete record. A malformed frame closes the session; caller must drop DTR/reopen to resync.

func (*Link) Tick

func (l *Link) Tick(now time.Duration) error

type Record

type Record struct {
	Kind      Kind
	Pass      uint8
	Epoch, ID uint64
	Offset    uint32
	Payload   []byte
}

func Decode

func Decode(src []byte) (Record, error)

Jump to

Keyboard shortcuts

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