Files
onvif/examples
Sebastian Norling 1ceef725ec fix(examples): secure credential handling and Errors-arm bug
Two findings from the resource/security and API reviews of the
streamtest example.

Credentials
-----------
* loadPassword resolves the camera password in order:
    1. ONVIF_PASSWORD environment variable (recommended).
    2. -password-file <path> (newline trimmed).
    3. Interactive prompt when nothing else is set.
* -password flag still works but now logs a WARNING that the value
  leaks into shell history and process listings. Documented as
  'INSECURE' in the flag help.
* Updated package godoc with a Credentials section.

Errors-arm bug
--------------
* Previous code: case e := <-s.Errors() with no ok check. When the
  Stream closed, this arm would spin on a closed channel printing
  '<nil>' forever (until ctx-done elsewhere unblocked it). Mirror
  the Events arm's ok pattern.
* Switched the error-log branch to inspect the typed errors added
  in the previous commit: ErrRecreateFailed gets a louder 'camera
  may be offline' log line; ErrPullFailed is a quieter
  'will retry' since the loop handles transient pull errors
  automatically.

Also prints '[after-reconnect]' on events carrying that flag so the
operator can see when the stream silently recovered a dropped
subscription — confirms the new observability surface is useful at
the CLI level.
2026-05-21 15:02:23 +02:00
..
2023-12-18 20:16:21 +01:00
2023-12-18 20:16:21 +01:00
2023-12-18 20:16:21 +01:00
2023-12-18 20:16:21 +01:00