Documentation ¶
Index ¶
- Variables
- func BindHost(c *Controller) (middleware.Middleware, error)
- func Cache(c *Controller) (middleware.Middleware, error)
- func Chaos(c *Controller) (middleware.Middleware, error)
- func Dnssec(c *Controller) (middleware.Middleware, error)
- func Errors(c *Controller) (middleware.Middleware, error)
- func Etcd(c *Controller) (middleware.Middleware, error)
- func File(c *Controller) (middleware.Middleware, error)
- func Health(c *Controller) (middleware.Middleware, error)
- func Kubernetes(c *Controller) (middleware.Middleware, error)
- func Loadbalance(c *Controller) (middleware.Middleware, error)
- func Log(c *Controller) (middleware.Middleware, error)
- func PProf(c *Controller) (middleware.Middleware, error)
- func Prometheus(c *Controller) (middleware.Middleware, error)
- func Proxy(c *Controller) (middleware.Middleware, error)
- func Rewrite(c *Controller) (middleware.Middleware, error)
- func Root(c *Controller) (middleware.Middleware, error)
- func SameNext(next1, next2 middleware.Handler) bool
- func Secondary(c *Controller) (middleware.Middleware, error)
- func Shutdown(c *Controller) (middleware.Middleware, error)
- func Startup(c *Controller) (middleware.Middleware, error)
- type Controller
Constants ¶
This section is empty.
Variables ¶
var EmptyNext = middleware.HandlerFunc(func(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (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 BindHost ¶
func BindHost(c *Controller) (middleware.Middleware, error)
BindHost sets the host to bind the listener to.
func Cache ¶
func Cache(c *Controller) (middleware.Middleware, error)
Cache sets up the root file path of the server.
func Chaos ¶
func Chaos(c *Controller) (middleware.Middleware, error)
Chaos configures a new Chaos middleware instance.
func Dnssec ¶
func Dnssec(c *Controller) (middleware.Middleware, error)
Dnssec sets up the dnssec middleware.
func Errors ¶
func Errors(c *Controller) (middleware.Middleware, error)
Errors configures a new errors middleware instance.
func Etcd ¶
func Etcd(c *Controller) (middleware.Middleware, error)
Etcd sets up the etcd middleware.
func File ¶
func File(c *Controller) (middleware.Middleware, error)
File sets up the file middleware.
func Health ¶
func Health(c *Controller) (middleware.Middleware, error)
func Kubernetes ¶
func Kubernetes(c *Controller) (middleware.Middleware, error)
Kubernetes sets up the kubernetes middleware.
func Loadbalance ¶
func Loadbalance(c *Controller) (middleware.Middleware, error)
Loadbalance sets up the root file path of the server.
func Log ¶
func Log(c *Controller) (middleware.Middleware, error)
Log sets up the logging middleware.
func PProf ¶
func PProf(c *Controller) (middleware.Middleware, error)
PProf returns a new instance of a pprof handler. It accepts no arguments or options.
func Prometheus ¶
func Prometheus(c *Controller) (middleware.Middleware, error)
func Proxy ¶
func Proxy(c *Controller) (middleware.Middleware, error)
Proxy configures a new Proxy middleware instance.
func Rewrite ¶
func Rewrite(c *Controller) (middleware.Middleware, error)
Rewrite configures a new Rewrite middleware instance.
func Root ¶
func Root(c *Controller) (middleware.Middleware, error)
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 Secondary ¶
func Secondary(c *Controller) (middleware.Middleware, error)
Secondary sets up the secondary middleware.
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.
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.