Documentation
¶
Overview ¶
Package fakenvr fakes a Reolink NVR's Baichuan port for tests: it logs a client in, then serves every preview the client asks for, as many as it asks for and on as many channels, interleaved on the one connection the way a recorder interleaves them.
Unlike internal/fakecam, which replays bytes and knows nothing of the protocol, a recorder has to read what the client asks for to know which channels to send, so this package decodes the client's requests with internal/baichuan. The media it sends is a real capture's, its channel and stream bytes rewritten per preview, so a client decodes real frames.
The capture must be one internal/baichuan/testdata holds, made under an empty password: the recorder logs in with the capture's own nonce, so the client's AES key matches the key the capture's media was sealed with.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Recorder ¶
type Recorder struct {
// Gap is the pause between two media messages of one preview.
Gap time.Duration
// contains filtered or unexported fields
}
Recorder is a fake NVR on a loopback address.
func New ¶
New starts a fake recorder serving the media in capture, a server-side capture from internal/baichuan/testdata that begins with a login.
func (*Recorder) DropAll ¶
func (r *Recorder) DropAll()
DropAll closes every open connection, as a recorder rebooting would.
func (*Recorder) Silence ¶
Silence stops sending channel's media, on every preview of it, while leaving the connection and every other channel running: a camera that has gone dark behind the recorder.