cors

package
v3.0.0-...-5669fa1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 10, 2024 License: GPL-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CorsObject

type CorsObject struct {
	FrameSrc       []string       `json:"frame-src"`
	ChildSrc       []string       `json:"child-src"`
	ConnectSrc     []string       `json:"connect-src"`
	ScriptSrc      []string       `json:"script-src"`
	OriginEmbedder EmbedderPolicy `json:"embedder-policy"`
	OriginOpener   OpenerPolicy   `json:"opener-policy"`
	OriginResource ResourcePolicy `json:"resource-policy"`
}

func NewCors

func NewCors() *CorsObject

func (*CorsObject) Child

func (cors *CorsObject) Child(childsrc ...string) *CorsObject

func (*CorsObject) Connect

func (cors *CorsObject) Connect(connectsrc ...string) *CorsObject

func (*CorsObject) Embedder

func (cors *CorsObject) Embedder(e EmbedderPolicy) *CorsObject

func (*CorsObject) Frame

func (cors *CorsObject) Frame(framesrc ...string) *CorsObject

func (*CorsObject) Opener

func (cors *CorsObject) Opener(o OpenerPolicy) *CorsObject

func (*CorsObject) RenderCors

func (cors *CorsObject) RenderCors(gtx *gin.Context)

func (*CorsObject) Resource

func (cors *CorsObject) Resource(r ResourcePolicy) *CorsObject

func (*CorsObject) Script

func (cors *CorsObject) Script(scriptsrc ...string) *CorsObject

type EmbedderPolicy

type EmbedderPolicy int
const (
	EmbedderUnsafeNone EmbedderPolicy = iota + 1
	EmbedderRequireCorp
	EmbedderCredentialLess
)

func (EmbedderPolicy) Policy

func (cep EmbedderPolicy) Policy() string

type HashAlgorithm

type HashAlgorithm int
const (
	HashAlgo256 HashAlgorithm = 256
	HashAlgo384 HashAlgorithm = 384
	HashAlgo512 HashAlgorithm = 512
)

type HashDirFs

type HashDirFs struct {
	// contains filtered or unexported fields
}

func NewHashDirFs

func NewHashDirFs(base_path string, route string, algo HashAlgorithm, replacements map[string]string) (hD *HashDirFs, err error)

func (*HashDirFs) GetNonce

func (hD *HashDirFs) GetNonce() (m map[string]string)

func (*HashDirFs) GetSingleNonce

func (hD *HashDirFs) GetSingleNonce(name string) string

func (*HashDirFs) NewServeDirFs

func (hD *HashDirFs) NewServeDirFs(r *gin.Engine, cors_ *CorsObject, cache_seconds time.Duration, reload bool) (err error)

func (*HashDirFs) Route

func (hD *HashDirFs) Route() string

func (*HashDirFs) SetRoute

func (hD *HashDirFs) SetRoute(r string)

type HashedFile

type HashedFile struct {
	// contains filtered or unexported fields
}

func NewHashedFile

func NewHashedFile(path string, algo HashAlgorithm) (h *HashedFile, err error)

func (*HashedFile) Nonce

func (h *HashedFile) Nonce() string

func (*HashedFile) Reload

func (h *HashedFile) Reload() (*HashedFile, error)

func (*HashedFile) Replace

func (h *HashedFile) Replace(mstr map[string]string) *HashedFile

func (*HashedFile) Str

func (h *HashedFile) Str() string

type OpenerPolicy

type OpenerPolicy int
const (
	OpenerUnsafeNone OpenerPolicy = iota + 1
	OpenerSameOriginAllowPopups
	OpenerSameOrigin
)

func (OpenerPolicy) Policy

func (cep OpenerPolicy) Policy() string

type ResourcePolicy

type ResourcePolicy int
const (
	ResourceSameSite ResourcePolicy = iota + 1
	ResourceSameOrigin
	ResourceCrossOrigin
)

func (ResourcePolicy) Policy

func (rp ResourcePolicy) Policy() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL