web

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateContentSecurityPolicy

func GenerateContentSecurityPolicy(fileContents []byte, cspEntries CSPEntries) string

GenerateContentSecurityPolicy for the given html file contents

Types

type CSPEntries

type CSPEntries struct {
	Default []string
	Script  []string
	Image   []string
	Style   []string
}

CSPEntries stores various values to be converted into the CSP Header value

func (CSPEntries) String

func (c CSPEntries) String() string

type Handler

type Handler struct {
	FileSystem      http.FileSystem
	RootHandler     http.Handler
	NotFoundHandler http.Handler
	// contains filtered or unexported fields
}

Handler is the Forge Handler

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP satisfies the http.Handler interface

type SinglePageAppHandler

type SinglePageAppHandler struct {
	FileSystem       http.FileSystem
	FileName         string
	DisableCSPHeader bool
	BaseCSPEntries   CSPEntries
}

SinglePageAppHandler serves a file from the http.FileSystem and adds headers relevant to serving a secure

func (*SinglePageAppHandler) ServeHTTP

func (s *SinglePageAppHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP satisfies the http.Handler interface

Jump to

Keyboard shortcuts

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