Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseResponseWriter ¶
type BaseResponseWriter struct {
http.ResponseWriter
}
Base wrapper that other plugins can embed
func (*BaseResponseWriter) Header ¶
func (b *BaseResponseWriter) Header() http.Header
func (*BaseResponseWriter) Unwrap ¶
func (b *BaseResponseWriter) Unwrap() http.ResponseWriter
func (*BaseResponseWriter) WriteHeader ¶
func (b *BaseResponseWriter) WriteHeader(statusCode int)
type Plugin ¶
type Plugin interface {
//If the plugin returns final, no further plugins will be executed
//The res at this stage won't have any data written from upstream and plugin can use to early return a response
HandleRequest(req *http.Request, res http.ResponseWriter) (final bool, err error)
// HandleResponse should be used when the plugin needs to act on the upstream response.
//NOTE: If the plugin wraps responsewriter then make sure to implement hijacker or websocket requests will fail
HandleResponse(*http.Request, http.ResponseWriter) http.ResponseWriter
Priority() int
GetConfig() PluginConf
ValidateAndSetConfig(PluginConf) error //Returns any validation error
Destroy() // garbage collection
}
type PluginFactory ¶
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
func NewRegistry ¶
func NewRegistry() *Registry
func (*Registry) Register ¶
func (r *Registry) Register(typ string, pluginFactory PluginFactory)
type ResponseWriterWrapper ¶
type ResponseWriterWrapper interface {
http.ResponseWriter
Unwrap() http.ResponseWriter
}
Click to show internal directories.
Click to hide internal directories.