rangefile

package
v0.3.18 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package rangefile serves seekable media and download files with stable strong validators (ETag and Last-Modified) and HTTP byte-range support so clients such as Apple URLSession / Plex for iOS can validate and resume interrupted transfers with Range and If-Range.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Serve

func Serve(w http.ResponseWriter, r *http.Request, name, identity string, size int64, modTime time.Time, content io.ReadSeeker)

Serve serves content with http.ServeContent after attaching a strong ETag (when identity is non-empty, size >= 0, and no ETag is already set) and truncating modTime to UTC seconds so HEAD/GET validators, Accept-Ranges, Content-Length, Range, and If-Range stay consistent across retries.

func ServeFile

func ServeFile(w http.ResponseWriter, r *http.Request, name, identity string, modTime time.Time, f *os.File) error

ServeFile stats f, falls back to f's mtime when modTime is zero, and serves the file with a strong ETag and HTTP byte-range support.

func ServeSeeker

func ServeSeeker(w http.ResponseWriter, r *http.Request, name, identity string, modTime time.Time, content io.ReadSeeker)

ServeSeeker determines content's byte length via Seek when the caller holds an io.ReadSeeker without an *os.File, then delegates to Serve.

func StrongETag

func StrongETag(identity string, size int64, modTime time.Time) string

StrongETag formats a deterministic strong quoted ETag (`"<20 hex>"`) from a stable representation identity, byte size, and modification timestamp truncated to HTTP-date second resolution (matching internal/playback).

Types

This section is empty.

Jump to

Keyboard shortcuts

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