protocol

package
v1.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 10, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUnexpectedStatus = errors.New("unexpected camera response status")

ErrUnexpectedStatus is returned when a camera answers with anything other than 200 OK. Callers that need to react to an unreachable-but-answering camera (rather than to any failure) can match it with errors.Is.

Functions

func MakeAuthenticatedRequest

func MakeAuthenticatedRequest(auth *string, method string, body string, url string) (*bytes.Buffer, int, error)

MakeAuthenticatedRequest Sends a request to the camera. Example usage: c.makeAuthenticatedRequest("GET", "/base","/some.cgi?preset=1") Returns the response body as a buffer.

Anything other than 200 OK is an error: a camera that is powered down but still answering, one that rejects the configured credentials, or one that fails internally must not look like a successful preset change or a valid snapshot to the caller. The status code is still returned alongside the error so callers can tell "unauthorized" from "not found" without matching on the message.

func SaveResponseBuffer

func SaveResponseBuffer(outDir string, filename string, resp *bytes.Buffer) error

SaveResponseBuffer saves the response buffer to a file. A failed write leaves no file behind: a truncated snapshot on disk is indistinguishable from a whole one for everything downstream, so the partial file is removed instead.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL