serve

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: BSD-3-Clause Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package serve answers proto requests with go-avkit: the worker's side of the protocol. It links go-avkit's container reader (MP4, WebM / Matroska) and go-avkit/decode's H.264 decoder, and nothing of a host: no syscall/js, so it is tested natively and run in a Web Worker by cmd/avkit-worker.

A file is untrusted. Whatever the client said of it (its key, its size, its limits), it is checked against the clamped limits (proto.Clamp) before the container reader is asked anything, and again, against the limits of the request at hand, each time a held file is read.

Index

Constants

View Source
const Keep = 2

Keep is how many files a Server holds: the project's videos that the renders of a page ask about, the most recent ones. Two 64 MiB files at most.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server holds the files it was sent and answers requests about them. Its methods are safe for concurrent use; they run one at a time.

func (*Server) Handle

func (s *Server) Handle(req proto.Request, payload []byte) (res proto.Response, img []byte)

Handle answers one request. payload is the file when req.HasData, and the picture of a poster's answer is the second result. The limits are proto.Clamp(req.Limits): a request lowers them, never raises them.

A panic in the container reader or the decoder, on a file nobody foresaw, is answered as a video.syntax refusal and the worker keeps serving.

Jump to

Keyboard shortcuts

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