Versions in this module Expand all Collapse all v1 v1.0.0 Apr 28, 2023 Changes in this version + func GetCSPFromWeb(webaddress string) (string, string) + type AllowDirective struct + func (AllowDirective) Check(Policy, SourceContext) (bool, error) + type Directive interface + Check func(Policy, SourceContext) (bool, error) + type HashSource struct + Algorithm func() hash.Hash + Value string + func (s HashSource) Check(ctx SourceContext) (bool, error) + type Policy struct + BlockAllMixedContent bool + Directives map[string]Directive + UpgradeInsecureRequests bool + func ParsePolicy(policy string) (Policy, error) + func (p Policy) Directive(name string) Directive + type Report struct + Blocked string + Context SourceContext + Directive Directive + DirectiveName string + Document string + func ValidatePage(p Policy, page url.URL, html io.Reader) (bool, []Report, error) + func ValidateStylesheet(p Policy, page url.URL, css string) (bool, []Report, error) + type SourceContext struct + Body []byte + Nonce string + Page url.URL + URL url.URL + UnsafeEval bool + UnsafeInline bool + func (s SourceContext) Report(name string, directive Directive) Report + type SourceDirective struct + Hashes []HashSource + Hosts []glob.Glob + Nonces map[string]bool + None bool + Schemes map[string]bool + Self bool + SrcHosts []string + UnsafeEval bool + UnsafeInline bool + func ParseSourceDirective(sources []string) (SourceDirective, error) + func (s *SourceDirective) ParseSource(source string) error + func (s *SourceDirective) Validate() error + func (s SourceDirective) Check(p Policy, ctx SourceContext) (bool, error)