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 ¶
- func Serve(w http.ResponseWriter, r *http.Request, name, identity string, size int64, ...)
- func ServeFile(w http.ResponseWriter, r *http.Request, name, identity string, ...) error
- func ServeSeeker(w http.ResponseWriter, r *http.Request, name, identity string, ...)
- func StrongETag(identity string, size int64, modTime time.Time) string
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 ¶
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.