Go Binary Protocols
Framing
- Length‑prefix
- Delimiter
- Out‑of‑band size
Varints
- 7 data bits + continuation bit
- Compact for small numbers
- Must handle malformed inputs
Incremental parsing
- Partial length
- Partial payload
- Return “need more” without consuming
Zero‑copy
- Slice into input buffer
- Copy only when you must retain
Safety
- Enforce max frame size
- Avoid overflow
Go tips
- Reuse buffers
- Keep allocs at 0 in parsers
1 / 1