Documentation ¶
Index ¶
Constants ¶
View Source
const ( // ErrProtectedFlag is returned when a protected flag is used ErrProtectedFlag = errors.Error("cannot use protected flag") // ErrInvalidHostPolicy is returned when the HostPolicy does not match the intended signature ErrInvalidHostPolicy = errors.Error("invalid HostPolicy handler within the autocert plugin") )
View Source
const ( // ErrInvalidTLSDirectory is returned when a tls directory is unset when the tls port has been set ErrInvalidTLSDirectory = errors.Error("invalid tls directory, cannot be empty when tls port has been set") // ErrInvalidPreInitFunc is returned when an unsupported pre initialization function is encountered ErrInvalidPreInitFunc = errors.Error("unsupported header for Init func encountered") // ErrInvalidLoadFunc is returned when an unsupported initialization function is encountered ErrInvalidLoadFunc = errors.Error("unsupported header for Load func encountered") // ErrNotAddressable is returned when a plugin is not addressable ErrNotAddressable = errors.Error("provided backend must be addressable") // ErrInvalidDir is returned when a directory is empty ErrInvalidDir = errors.Error("invalid directory, cannot be empty") // ErrPluginKeyExists is returned when a plugin cannot be added because it already exists ErrPluginKeyExists = errors.Error("plugin cannot be added, key already exists") // ErrPluginNotLoaded is returned when a plugin namespace is provided that has not been loaded ErrPluginNotLoaded = errors.Error("plugin with that key has not been loaded") // ErrExpectedEndParen is returned when an ending parenthesis is missing ErrExpectedEndParen = errors.Error("expected ending parenthesis") // ErrInvalidPluginHandler is returned when a plugin handler is not valid ErrInvalidPluginHandler = errors.Error("plugin handler not valid") )
View Source
const ( // ErrGroupNotFound is returned when a group cannot be found by name ErrGroupNotFound = errors.Error("group not found") )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BasePlugin ¶ added in v0.11.0
type BasePlugin struct{}
func (*BasePlugin) Backend ¶ added in v0.11.0
func (b *BasePlugin) Backend() interface{}
func (*BasePlugin) Close ¶ added in v0.11.0
func (b *BasePlugin) Close() error
func (*BasePlugin) Init ¶ added in v0.11.0
func (b *BasePlugin) Init(env Environment) error
func (*BasePlugin) Load ¶ added in v0.11.0
func (b *BasePlugin) Load(env Environment) error
type Config ¶ added in v0.15.0
type Config struct { Name string `toml:"name"` Dir string `toml:"dir"` Port uint16 `toml:"port"` // TLSPort to listen on. To use TLS one of the two must be set: // - TLSDir // - AutoCertHosts/AutoCertDir TLSPort uint16 `toml:"tlsPort"` TLSDir string `toml:"tlsDir"` IncludeConfig Flags map[string]string `toml:"-"` // Plugin keys as they are referenced by the plugins store PluginKeys []string ErrorLogger func(error) }
Config is the configuration needed to initialize a new instance of Service
func (*Config) GetRouteGroup ¶ added in v0.15.0
func (c *Config) GetRouteGroup(name string) (g *RouteGroup, err error)
GetGroup will return group with name
type Environment ¶ added in v0.13.0
func (Environment) Get ¶ added in v0.13.0
func (e Environment) Get(key string) (out string)
type Flag ¶ added in v0.15.0
type Flag struct { Name string `toml:"name"` DefaultValue string `toml:"defaultValue"` Usage string `toml:"usage"` }
Flag represents a flag entry
type IncludeConfig ¶ added in v0.15.0
type IncludeConfig struct { AutoCertHosts []string `toml:"autoCertHosts"` AutoCertDir string `toml:"autoCertDir"` // Application environment Environment map[string]string `toml:"env"` // Allow included files to add includes Include []string `toml:"include"` // Specify which plugins are in scope Plugins []string `toml:"plugins"` // Flags are the dynamic flags specified in config FlagEntries []*Flag `toml:"flag"` // Groups are the route groups Groups []*RouteGroup `toml:"group"` // Routes are the routes to listen for and serve Routes []*Route `toml:"route"` }
IncludeConfig will include routes
type Plugin ¶ added in v0.11.0
type Plugin interface { Init(env Environment) error Load(env Environment) error Backend() interface{} Close() error }
type Plugins ¶ added in v0.11.0
type Plugins struct {
// contains filtered or unexported fields
}
Plugins manages loaded plugins
type Response ¶ added in v0.15.0
type Response struct { StatusCode int ContentType string Value interface{} // Optional fields used by a minority of responses Adopted bool Callback string }
Response determines how the server will respond
func NewAdopedtResponse ¶ added in v0.15.0
func NewAdopedtResponse() *Response
NewAdopedtResponse will return a new adopted Response
func NewResponse ¶ added in v0.15.0
NewResponse will return a new Response
type Route ¶ added in v0.15.0
type Route struct { // Target plug-in handler HTTPHandlers []httpserve.Handler `toml:"-"` // Route name/description Name string `toml:"name"` // Route group Group string `toml:"group"` // HTTP method Method string `toml:"method"` // HTTP path HTTPPath string `toml:"httpPath"` // Directory or file to serve Target string `toml:"target"` // Plugin handlers Handlers []string `toml:"handlers"` }
Route represents a listening route
type RouteGroup ¶ added in v0.15.0
type RouteGroup struct { Name string `toml:"name"` // Route group Group string `toml:"group"` // HTTP method Method string `toml:"method"` // HTTP path HTTPPath string `toml:"httpPath"` // Plugin handlers Handlers []string `toml:"handlers"` HTTPHandlers []httpserve.Handler `toml:"-"` G httpserve.Group `toml:"-"` }
RouteGroup represents a route group
type Vroomy ¶ added in v0.9.0
type Vroomy struct {
// contains filtered or unexported fields
}
Vroomy manages the web service
func NewWithConfig ¶ added in v0.9.0
NewWithConfig will return a new instance of service with a provided config
Click to show internal directories.
Click to hide internal directories.