Documentation
¶
Index ¶
- Constants
- Variables
- func Fingerprint(get Settings) string
- func MergeOrigins(lists ...[]string) []string
- func Nonce(r *http.Request) string
- func RequestIsHTTPS(r *http.Request) bool
- type CSP
- func (c *CSP) Add(directive string, sources ...string) *CSP
- func (c *CSP) Clone() *CSP
- func (c *CSP) Has(directive string) bool
- func (c *CSP) Remove(directive string) *CSP
- func (c *CSP) Set(directive string, sources ...string) *CSP
- func (c *CSP) Sources(directive string) []string
- func (c *CSP) String() string
- type Change
- type Config
- type Editor
- type EffectiveHeaders
- type Form
- type Live
- type Request
- type Settings
- type View
Constants ¶
View Source
const ( ErrXFrame = "sec_hdr_err_xframe" ErrHSTSMaxAge = "sec_hdr_err_hsts_max_age" ErrHSTSPreload = "sec_hdr_err_hsts_preload" ErrNoSniff = "sec_hdr_err_nosniff" ErrReferrer = "sec_hdr_err_referrer" ErrPermissions = "sec_hdr_err_permissions" ErrCSPExtra = "sec_hdr_err_csp_extra" ErrCSPUnsafe = "sec_hdr_err_csp_unsafe" ErrCSPFull = "sec_hdr_err_csp_full" ErrCORS = "sec_hdr_err_cors" )
View Source
const ( KeyXFrameOptions = "security_x_frame_options" KeyHSTSMaxAge = "security_hsts_max_age_seconds" KeyHSTSIncludeSubs = "security_hsts_include_subdomains" KeyHSTSPreload = "security_hsts_preload" KeyHSTSDisabled = "security_hsts_disabled" KeyCSP = "security_csp" KeyCSPExtra = "security_csp_extra" KeyXContentTypeOptions = "security_x_content_type_options" KeyReferrerPolicy = "security_referrer_policy" KeyPermissionsPolicy = "security_permissions_policy" KeyCORSOrigins = "security_cors_allowed_origins" )
Variables ¶
View Source
var ( XFrameChoices = []string{"DENY", "SAMEORIGIN"} ReferrerChoices = []string{"no-referrer", "no-referrer-when-downgrade", "origin", "origin-when-cross-origin", "same-origin", "strict-origin", "strict-origin-when-cross-origin", "unsafe-url"} )
Functions ¶
func Fingerprint ¶ added in v1.4.0
func MergeOrigins ¶
func RequestIsHTTPS ¶
Types ¶
type Config ¶
type Config struct {
XFrameOptions string
HSTSMaxAgeSeconds int
HSTSIncludeSubDomains bool
HSTSPreload bool
HSTSDisabled bool
CSP *CSP
XContentTypeOptions string
ReferrerPolicy string
PermissionsPolicy string
CORSAllowedOrigins []string
CORSAllowedHeaders []string
StyleNonce bool
NoStoreCacheControl string
StaticPrefixes []string
StaticPaths []string
StaticCacheControl string
LegacyHeaders bool
PerRequest func(r *http.Request, rq *Request)
}
func (*Config) ApplySettings ¶
type EffectiveHeaders ¶ added in v1.4.0
type Form ¶ added in v1.4.0
type Form struct {
XFrameOptions string
HSTSDisabled bool
HSTSMaxAge string
HSTSIncludeSubs bool
HSTSPreload bool
ContentTypeOptions string
ReferrerPolicy string
PermissionsPolicy string
CSPExtra string
CSPFull string
CORSOrigins string
}
func FormFromRequest ¶ added in v1.4.0
type View ¶ added in v1.4.0
type View struct {
Form Form
Errors map[string]string
Effective EffectiveHeaders
Defaults EffectiveHeaders
}
Click to show internal directories.
Click to hide internal directories.