Documentation
¶
Index ¶
- Variables
- func BuildRoutes(config Config) (map[string]Route, error)
- func CompressAll(compression Compression, r io.Reader) ([]byte, error)
- func Execute() error
- func IsAtty(file *os.File) bool
- func Max[T constraints.Ordered](a, b T) T
- type ByteSize
- type Cache
- type Compression
- type Config
- type Creator
- type Handler
- type Nonce
- type NoncedRoute
- type Route
- type RouteFlag
- type StaticRoute
Constants ¶
This section is empty.
Variables ¶
View Source
var Brotli = compression{ // contains filtered or unexported fields }
View Source
var Deflate = compression{ // contains filtered or unexported fields }
View Source
var ErrNonNonceable = errors.New("route is not nonceable")
View Source
var GZIP = compression{ // contains filtered or unexported fields }
View Source
var Identity = identity{}
Functions ¶
func CompressAll ¶
func CompressAll(compression Compression, r io.Reader) ([]byte, error)
func Max ¶
func Max[T constraints.Ordered](a, b T) T
Types ¶
type Cache ¶
type Compression ¶
type Compression interface { Wrap(io.Writer) io.WriteCloser WriteEncodingHeader(http.ResponseWriter) AddExtension(string) string }
type Config ¶
type Config struct { Address string `short:"a" long:"address" description:"address to listen to" default:"0.0.0.0"` Port int `short:"p" long:"port" description:"port to listen on" default:"80"` Verbose []bool `short:"v" long:"verbose" description:"Enable verbose logging for each request"` Compression struct { NoGZIP bool `long:"no-gzip" description:"disable gzip compression"` NoDeflate bool `long:"no-deflate" description:"disable deflate compression"` NoBrotli bool `long:"no-brotli" description:"disable brotli compression"` Eligible []string `` /* 230-byte string literal not displayed */ Threshold ByteSize `long:"threshold" description:"file size threshold to enable compression" default:"1k"` } `group:"compression" namespace:"compression"` Cache struct { MaxAge time.Duration `long:"max-age" description:"Cache-Control max-age on unversionned files" default:"0s"` } `group:"cache-control" namespace:"cache"` ServerCache struct { RootFileInLRU bool `` /* 189-byte string literal not displayed */ MaxMemorySize ByteSize `short:"m" long:"max-size" description:"maximal size of the cache in bytes" default:"50M"` } `group:"server-cache" namespace:"server-cache"` CSP struct { Disable bool `long:"nonce-disable" description:"Disable CSP Nonce generation"` NoncedPath []string `short:"O" long:"nonced" description:"list of nonced file" default:"/index.html"` Policy string `` /* 140-byte string literal not displayed */ } `group:"csp-nonce" namespace:"csp"` Otel struct { Endpoint string `long:"endpoint" description:"Open Telemetry Collectore Endpoint"` ServiceName string `long:"name" description:"Service name to report" default:"angular-to-http"` ServiceInstanceID string `long:"instance" description:"Service Instance ID, if empty hostname will be used"` } `group:"otel" namespace:"otel"` Args struct { Directory string `description:"directory to serve (default: '.')" positional-arg-name:"directory"` } `positional-args:"yes"` }
func (*Config) AllowedCompressions ¶
func (*Config) EnabledCompressions ¶
func (c *Config) EnabledCompressions() []Compression
type NoncedRoute ¶
type NoncedRoute struct {
// contains filtered or unexported fields
}
func (NoncedRoute) Flags ¶
func (r NoncedRoute) Flags() RouteFlag
func (NoncedRoute) PreCache ¶
func (r NoncedRoute) PreCache() int64
func (NoncedRoute) ServeHTTP ¶
func (r NoncedRoute) ServeHTTP(w http.ResponseWriter, req *http.Request)
type StaticRoute ¶
type StaticRoute struct {
// contains filtered or unexported fields
}
func (StaticRoute) Flags ¶
func (r StaticRoute) Flags() RouteFlag
func (StaticRoute) PreCache ¶
func (r StaticRoute) PreCache() int64
func (StaticRoute) ServeHTTP ¶
func (r StaticRoute) ServeHTTP(w http.ResponseWriter, req *http.Request)
Click to show internal directories.
Click to hide internal directories.