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 ¶
- type Preview
- type Recorder
- func (r *Recorder) Accepts() int
- func (r *Recorder) Addr() string
- func (r *Recorder) DropAll()
- func (r *Recorder) Forget(channel int)
- func (r *Recorder) MaxOpen() int
- func (r *Recorder) Open() int
- func (r *Recorder) Silence(channel int, on bool)
- func (r *Recorder) Starts() []Preview
- func (r *Recorder) Stops() []Preview
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
// StopUnknownStartsMain models what #49 points at on an RLN8-410: a
// stop naming a handle the recorder no longer has (its camera
// dropped, see Forget) is taken as a new request with no stream type,
// so the main stream, and is served tagged with the stop's own offset,
// whose stream byte may be the sub stream's.
StopUnknownStartsMain bool
// NoCounterEcho clears the counter byte of every media message's
// offset, for a recorder that does not echo it: a client must still
// tell its previews apart by channel and stream.
NoCounterEcho bool
// 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) Forget ¶ added in v0.2.10
Forget ends every preview of channel on every connection without a word to the client, as a recorder does when that channel's camera drops.
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.