Documentation
¶
Index ¶
- type Manager
- type Option
- type Route
- type Server
- type ServerOption
- func WithEndpoint(host string, port uint, prefix string) ServerOption
- func WithMeter(meter model.Meter) ServerOption
- func WithMiddlewareConfigs(defaults []byte) ServerOption
- func WithMiddlewares(mws ...api.Middleware) ServerOption
- func WithTLS(cert certutil.CertBundle, clientCAs ...*x509.Certificate) ServerOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager interface {
common.Service
common.Liveness
common.Readiness
common.Initializable
common.Daemon
Get(name string) (Server, error)
List() []Server
RegisterRouters(routers ...api.Router) error
RegisterMiddlewares(middlewares ...api.Middleware) error
// Add returns a Conflict for a name already added.
Add(name string, opts ...ServerOption) error
}
type Route ¶ added in v0.9.2
type Route struct {
Server string
Prefix string // its group's
Method string
Path string // the prefix joined with the handler's own path
Func string
Permission string
}
Route is one handler a router's config declares.
func CheckRouter ¶ added in v0.9.2
CheckRouter parses r's config and resolves its handlers as RegisterRouters does, needing no server: a test calls it, so a router that would fail startup - a func its Handlers lack, a signature discovery skipped, a route declared twice - fails its tests instead. It returns what the config declares.
type ServerOption ¶
type ServerOption func(*server)
func WithEndpoint ¶
func WithEndpoint(host string, port uint, prefix string) ServerOption
func WithMeter ¶ added in v0.6.15
func WithMeter(meter model.Meter) ServerOption
WithMeter enables HTTP metrics; the meter is not a dependency, so a collector outage never takes down the listener.
func WithMiddlewareConfigs ¶ added in v0.6.1
func WithMiddlewareConfigs(defaults []byte) ServerOption
WithMiddlewareConfigs maps name to a switch (boolean) or config block; a WithMiddlewares entry without a key stays dormant.
func WithMiddlewares ¶ added in v0.6.0
func WithMiddlewares(mws ...api.Middleware) ServerOption
WithMiddlewares runs on every request, matched or not (e.g. cors), before RequestInfo exists.
func WithTLS ¶
func WithTLS(cert certutil.CertBundle, clientCAs ...*x509.Certificate) ServerOption
WithTLS serves https with cert, verifying a client certificate, when one is given, against clientCAs; none is asked for without them.