Documentation ¶
Overview ¶
Package vprule defines how to determine the validity period of signed exchanges.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Rule ¶
type Rule interface { // Get returns ValidPeriod for resp. date is the value of vp.Date(), // where vp is the ValidPeriod. Get(resp *exchange.Response, date time.Time) exchange.ValidPeriod }
Rule determines the validity period of the provided signed exchange.
var DefaultRule Rule = FixedLifetime(24 * time.Hour)
DefaultRule is the default rule used by webpackager.Packager.
func FixedLifetime ¶
FixedLifetime applies a fixed lifetime to all signed exchanges.
func PerContentType ¶
PerContentType specifies a Rule per media type. rules is a map from media types to Rules; ruleElse is the Rule applied to other media types. The map keys should be all in lowercase and include no media parameters (e.g. "text/html", not "text/HTML" or "text/html; charset=utf-8").
PerContentType looks for a rule applicable to the resp's Content-Type first. If there is none, PerContentType also looks for a rule for each Webpackager-Sub-Content-Type (resp.ExtraData[exchange.SubContentType]). If there is still no rule to apply, PerContentType applies ruleElse.