Developer Guide#
go-rtmp is a pure Go (1.21+) RTMP server with zero external dependencies. The architecture is a layered stack that mirrors the RTMP protocol itself — each layer only depends on the one below it, with no circular imports.
TCP → Handshake → Chunk → Control/AMF0 → RPC → Conn → ServerEvery package under internal/rtmp/ maps to a single protocol concern. This makes the codebase easy to navigate once you understand the protocol layers.
Reading Order for New Contributors#
If you’re new to the project, read the code in this order:
- Architecture — understand the layers and data flow
- Design Principles — why decisions were made
- RTMP Protocol Reference — the wire format you’re implementing
- Testing Guide — how to validate your changes
- Contributing — workflow and conventions
Testing Philosophy#
The project follows a strict testing philosophy:
- Golden binary vectors — exact wire-format
.binfiles validate every encoder and decoder against known-good byte sequences - Table-driven tests — every test case is a row in a struct slice, making it trivial to add new cases
- No mocks — tests use real
net.Pipe()connections for end-to-end validation through the actual protocol stack - Race detector — all CI runs use
go test -raceto catch concurrency bugs
This approach ensures that if the tests pass, the bytes on the wire are correct.