Documentation ¶
Overview ¶
Package http2preload provides a way to manipulate HTTP/2 preload header. See https://w3c.github.io/preload/ for Preload feature details.
Index ¶
Constants ¶
const ( Audio = "audio" Font = "font" Image = "image" Script = "script" Style = "style" Track = "track" Video = "video" )
Request types, as specified by https://fetch.spec.whatwg.org/#concept-request-type
Variables ¶
This section is empty.
Functions ¶
func AddHeader ¶
AddHeader adds a "link" header to hdr for each assets entry, as specified in https://w3c.github.io/preload/. "scheme://base" will be prepended to a key of assets which are not prefixed with "http:" or "https:".
Types ¶
type AssetOpt ¶
type AssetOpt struct { // Type is the resource type Type string `json:"type,omitempty"` // Weight is not used in the HTTP/2 preload spec // but some HTTP/2 servers, while implementing stream priorities, // could benefit from this manifest format as well. Weight uint8 `json:"weight,omitempty"` }
AssetOpt defines a single resource options.
type Manifest ¶
Manifest is the preload manifest map where each value, being a collection of resources to be preloaded, keyed by a serving URL path which requires those resources.
func ReadManifest ¶
ReadManifest reads a push manifest from name file. It caches the value in memory so that subsequent requests won't hit the disk again.
A manifest file can also be generated with a tool found in cmd/http2preload-manifest.
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
http2preload-manifest
This program generates preload manifest in JSON format.
|
This program generates preload manifest in JSON format. |
Package generate parses HTML and extracts assets suitable for constructing http2preload.Manifest.
|
Package generate parses HTML and extracts assets suitable for constructing http2preload.Manifest. |