Documentation
¶
Index ¶
Constants ¶
View Source
const Version = "0.1.0"
Version defines the current package semantic version.
Variables ¶
View Source
var ( // DefaultPort stores the default TCP port to listen. DefaultPort = 8080 // DefaultReadTimeout defines the maximum timeout for request read. DefaultReadTimeout = 60 // DefaultWriteTimeout defines the maximum timeout for response write. DefaultWriteTimeout = 60 )
Functions ¶
func Listen ¶
func Listen(server *http.Server, opts ServerOptions) error
Listen starts listening on the network.
func NewServer ¶
func NewServer(o ServerOptions) *http.Server
NewServer creates a new admin HTTP server.
Types ¶
type JSONPlugin ¶
type JSONScope ¶
type JSONScope struct {
ID string `json:"id"`
Name string `json:"name,omitempty"`
Rules []JSONRule `json:"rules,omitempty"`
Plugins []JSONPlugin `json:"plugins,omitempty"`
}
type Manager ¶
func (*Manager) HandleHTTP ¶
func (*Manager) ServeAndListen ¶
func (m *Manager) ServeAndListen(opts ServerOptions) (*http.Server, error)
type Plugin ¶
type Plugin interface {
// ID is used to retrieve the plugin unique identifier.
ID() string
// Name is used to retrieve the plugin name identifier.
Name() string
// Description is used to retrieve a human friendly
// description of what the plugin does.
Description() string
// Enable is used to enable the current plugin.
// If the plugin has been already enabled, the call is no-op.
Enable()
// Disable is used to disable the current plugin.
Disable()
// Remove is used to disable and remove a plugin.
// Remove()
// IsEnabled is used to check if a plugin is enabled or not.
IsEnabled() bool
// HandleHTTP is used to run the plugin task.
// Note: add erro reporting layer
HandleHTTP(http.Handler) http.Handler
}
Plugin represents the required interface implemented by plugins.
type PluginLayer ¶
type PluginLayer struct {
// contains filtered or unexported fields
}
PluginLayer represents a plugins layer designed to intrument proxies providing plugin based dynamic configuration capabilities, such as register/unregister or enable/disable plugins at runtime satefy.
func NewPluginLayer ¶
func NewPluginLayer() *PluginLayer
NewPluginLayer creates a new plugins layer.
func (*PluginLayer) Len ¶
func (l *PluginLayer) Len() int
func (*PluginLayer) Register ¶
func (l *PluginLayer) Register(mw *layer.Layer)
Register implements the middleware Register method.
func (*PluginLayer) Run ¶
func (l *PluginLayer) Run(w http.ResponseWriter, r *http.Request, h http.Handler)
func (*PluginLayer) Use ¶
func (l *PluginLayer) Use(plugin Plugin)
Click to show internal directories.
Click to hide internal directories.
