serverpush

package module
v0.0.0-...-de76cc0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2018 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Overview

Package serverpush implements a HTTP/2 Server Push aware http.Handler.

It looks for Link headers in the response with rel=preload and will automatically push each linked resource. If the nopush attribute is included the resource will not be pushed.

It uses a DEFLATE compressed bloom filter to store a probabilistic view of resources that have already been pushed to the client.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EstimateParameters

func EstimateParameters(n uint, p float64) (m, k uint)

EstimateParameters estimates requirements for m and k.

func IsPush

func IsPush(r *http.Request) bool

IsPush returns true iff the request was pushed by this package.

Types

type Handler

type Handler = http.Handler

Handler is an alias to http.Handler for godoc.

func New

func New(m, k uint, handler http.Handler, opts *Options) Handler

New wraps the given http.Handler in a push aware handler.

func Redirects

func Redirects(h http.Handler, opts *http.PushOptions) Handler

Redirects wraps the given http.Handler and pushes the Location of redirects to clients.

type Middleware

type Middleware = func(http.Handler) http.Handler

Middleware represents a function that wraps an http.Handler.

func RedirectsWrap

func RedirectsWrap(opts *http.PushOptions) Middleware

RedirectsWrap returns a Middleware that calls Redirects.

func Wrapper

func Wrapper(m, k uint, opts *Options) Middleware

Wrapper returns a Middleware that calls New.

type Options

type Options struct {
	Cookie      *http.Cookie
	PushOptions *http.PushOptions
}

Options specifies additional options to change the behaviour of the handler.

Jump to

Keyboard shortcuts

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