setup

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2015 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EmptyNext = middleware.HandlerFunc(func(w http.ResponseWriter, r *http.Request) (int, error) {
	return 0, nil
})

EmptyNext is a no-op function that can be passed into middleware.Middleware functions so that the assignment to the Next field of the Handler can be tested.

Used primarily for testing but needs to be exported so add-ons can use this as a convenience.

Functions

func BasicAuth

func BasicAuth(c *Controller) (middleware.Middleware, error)

BasicAuth configures a new BasicAuth middleware instance.

func BindHost

func BindHost(c *Controller) (middleware.Middleware, error)

BindHost sets the host to bind the listener to.

func Browse

func Browse(c *Controller) (middleware.Middleware, error)

Browse configures a new Browse middleware instance.

func Errors

func Errors(c *Controller) (middleware.Middleware, error)

Errors configures a new gzip middleware instance.

func Ext

Ext configures a new instance of 'extensions' middleware for clean URLs.

func FastCGI

func FastCGI(c *Controller) (middleware.Middleware, error)

FastCGI configures a new FastCGI middleware instance.

func Gzip

Gzip configures a new gzip middleware instance.

func Headers

func Headers(c *Controller) (middleware.Middleware, error)

Headers configures a new Headers middleware instance.

func Internal

func Internal(c *Controller) (middleware.Middleware, error)

Internal configures a new Internal middleware instance.

func Log

Log sets up the logging middleware.

func Markdown

func Markdown(c *Controller) (middleware.Middleware, error)

Markdown configures a new Markdown middleware instance.

func Mime

Mime configures a new mime middleware instance.

func Proxy

Proxy configures a new Proxy middleware instance.

func Redir

Redir configures a new Redirect middleware instance.

func Rewrite

func Rewrite(c *Controller) (middleware.Middleware, error)

Rewrite configures a new Rewrite middleware instance.

func Root

Root sets up the root file path of the server.

func SameNext

func SameNext(next1, next2 middleware.Handler) bool

SameNext does a pointer comparison between next1 and next2.

Used primarily for testing but needs to be exported so add-ons can use this as a convenience.

func SetDefaultTLSParams

func SetDefaultTLSParams(c *server.Config)

SetDefaultTLSParams sets the default TLS cipher suites, protocol versions and server preferences of a server.Config if they were not previously set.

func Shutdown

func Shutdown(c *Controller) (middleware.Middleware, error)

Shutdown registers a shutdown callback to execute during process exit.

func Startup

func Startup(c *Controller) (middleware.Middleware, error)

Startup registers a startup callback to execute during server start.

func TLS

TLS sets up the TLS configuration (but does not activate Let's Encrypt; that is handled elsewhere).

func Templates

func Templates(c *Controller) (middleware.Middleware, error)

Templates configures a new Templates middleware instance.

func WebSocket

func WebSocket(c *Controller) (middleware.Middleware, error)

WebSocket configures a new WebSocket middleware instance.

Types

type Controller

type Controller struct {
	*server.Config
	parse.Dispenser

	// OncePerServerBlock is a function that executes f
	// exactly once per server block, no matter how many
	// hosts are associated with it. If it is the first
	// time, the function f is executed immediately
	// (not deferred) and may return an error which is
	// returned by OncePerServerBlock.
	OncePerServerBlock func(f func() error) error

	// ServerBlockIndex is the 0-based index of the
	// server block as it appeared in the input.
	ServerBlockIndex int

	// ServerBlockHostIndex is the 0-based index of this
	// host as it appeared in the input at the head of the
	// server block.
	ServerBlockHostIndex int

	// ServerBlockHosts is a list of hosts that are
	// associated with this server block. All these
	// hosts, consequently, share the same tokens.
	ServerBlockHosts []string

	// ServerBlockStorage is used by a directive's
	// setup function to persist state between all
	// the hosts on a server block.
	ServerBlockStorage interface{}
}

Controller is given to the setup function of middlewares which gives them access to be able to read tokens and set config. Each virtualhost gets their own server config and dispenser.

func NewTestController

func NewTestController(input string) *Controller

NewTestController creates a new *Controller for the input specified, with a filename of "Testfile". The Config is bare, consisting only of a Root of cwd.

Used primarily for testing but needs to be exported so add-ons can use this as a convenience. Does not initialize the server-block-related fields.

Jump to

Keyboard shortcuts

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