Skip to main content

Crate dahua_camera_server

Crate dahua_camera_server 

Source
Expand description

HTTP, Server-Sent Events and WebSocket delivery.

Handlers are thin: each one extracts, calls into a port or into dahua-camera-rtsp, and translates the result back to HTTP. Anything that looks like logic belongs upstream of this crate.

§Transports are never multiplexed

Video goes over its own WebSocket, one socket per viewer, carrying fMP4 fragments and nothing else. Events go over a separate stream. They are deliberately not merged onto one connection: a chatty event feed must never be able to delay a frame, and an event client that stops reading must never apply backpressure to video.

§Security

router() installs a permissive CORS layer. That is safe only under the deployment this workspace assumes — the listener binds to loopback and a local shell is the only client. This service holds credentials for every camera and performs no authentication of its own, so binding it to a routable address exposes every camera to anything that can reach the port.

Re-exports§

pub use router::router;
pub use router::router_with_assets;
pub use state::AppState;
pub use state::AppStateInner;

Modules§

dto
Wire types for the JSON API.
handlers
Request handlers. Each one is a thin translation between HTTP and the application layer; anything that looks like logic belongs upstream of here.
router
Route table.
state
Shared state for every handler.