Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetFileHash ¶ added in v0.1.6
GetFileHash looks for a hash as a suffix to a file (e.g, "foo-JK1llaO.js").
func GetQueryHash ¶ added in v0.1.6
GetQueryHash matches a complete input to whether it looks like a long-term hash.
Types ¶
type FileInfo ¶
type FileInfo struct { // Any available hash from the file's contents, or CRC or something. ContentHash string // ContentType if known. ContentType string // Additional headers to include, e.g, for CSP Header http.Header }
FileInfo is returned from Content.
type ServeFs ¶
type ServeFs struct { Content Content // AddPrefix is added to all paths before being checked inside Content. AddPrefix string // Normally, no files "foo.html" are served. This allows them to be served at "foo", without a trailing slash. // If "foo.html" AND "foo/index.html" exist, only the latter will be served. ServeNakedHtml bool // AllowFrame controls the X-Frame-Options header. AllowFrame bool // HtmlNotFoundPath is loaded from Content if we think this is a missing page (with a trailing slash). It does not have AddPrefix applied to it. HtmlNotFoundPath string // InsertHtmlHash controls whether a short `<!--:<hash>:-->` is added to each served HTML page. InsertHtmlHash bool // UpdateHeader may be provided to update the headers of returned responses. Useful for CSP. UpdateHeader func(http.Header, ServeInfo) }
ServeFs implements http.Handler.
Click to show internal directories.
Click to hide internal directories.