agent

package
v0.62.0 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package agent is the media access agent run by cmd/media-access. For the namespaces served on the request's host it streams, from a private bucket with its own read-only key:

/v1/{ns}/{kind}/{id}/public/{name}         to anyone; when missing, {ns}/{kind}/_default/public/{name}
                                           if a Default declares the name
/v1/{ns}/{kind}/{id}/private/sha256-{hex}  with the item's unexpired token (?t= or an mt cookie);
                                           ?dl={name} serves it as a download under that name

A token opens every private file of its item or none. Everything else and every denial is one identical no-store 404; token denials are decided before any bucket access. It keeps no state, reads no manifests and no databases, and knows nothing of apps, presets or originals.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Endpoint, Bucket, Region     string // path-style S3 endpoint; Region default us-east-1
	AccessKeyID, SecretAccessKey string // a key that can read only */private/* and */public/*
	Ring                         token.Ring
	Hosts                        map[string][]string // lower-case host name (no port) -> namespaces served on it; required
	Origins                      []string            // exact CORS origins ("scheme://host[:port]") allowed with credentials
	Defaults                     []layout.Default    // public default images
	Client                       *http.Client        // default: a tuned transport without compression
	Logger                       *slog.Logger
}

Config configures a Handler.

type Handler

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

Handler serves media objects.

func New

func New(cfg Config) (*Handler, error)

New validates cfg.

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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