blobhttp

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: MIT 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 blobhttp serves vault files' contents by their hash over HTTP (ADR-0023): GET and HEAD <prefix><sha256>.<ext>, with the content type the extension names, a policy that keeps the bytes passive, immutable caching and one Range per request (docs/specs/rpc-protocol.md, Transports). The development gateway serves it at /blobs/, and the lodge app socket at /content/blobs/ (docs/specs/lodge-app.md#contentblobs).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContentMAC

func ContentMAC(key []byte, hash string) string

ContentMAC names a blob in a keyed URL: HMAC-SHA256 of "frostnotes content\n" + its hash under key, in unpadded base64url (docs/specs/lodge-app.md#contentblobs). Without the key a page cannot make a file's URL, so it cannot learn whether a file it knows is there.

func ContentType

func ContentType(ext string) string

ContentType returns the media type the app serves a vault file with, by its lower-cased extension (docs/design/app.md#attachments).

func Handler

func Handler(store *blobs.Store, opts Options) http.Handler

Handler serves store's blobs under opts.Prefix.

Types

type Options

type Options struct {
	// Prefix is the path before a blob's name, such as "/blobs/".
	Prefix string
	// MaxRange is the most bytes a 206 carries: a longer range, or an
	// open one, is cut to it.
	MaxRange int64
	// MaxWhole is the largest blob answered whole; a larger one without a
	// Range is 413.
	MaxWhole int64
	// Download lets ?download=1 add Content-Disposition: attachment, for
	// files a browser will not show in a sandboxed page.
	Download bool
	// Key, when set, makes paths <mac>/<sha256>.<ext>, the mac being
	// ContentMAC under it; a path without the right one is 404.
	Key []byte
}

Options configure a Handler. Zero limits are none.

Jump to

Keyboard shortcuts

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