Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterHttpFilter ¶
func RegisterHttpFilter(f HttpFilterPlugin)
Register registers filter plugin.
func RegisterNetworkFilter ¶
func RegisterNetworkFilter(f NetworkFilterPlugin)
Register registers network filter.
Types ¶
type FilterManager ¶
type FilterManager struct {
// contains filtered or unexported fields
}
FilterManager manage filters
func NewEmptyFilterManager ¶
func NewEmptyFilterManager() *FilterManager
NewEmptyFilterManager create empty filter manager
func NewFilterManager ¶
func NewFilterManager(fs []*model.HTTPFilter) *FilterManager
NewFilterManager create filter manager
func (*FilterManager) Apply ¶
func (fm *FilterManager) Apply(name string, conf map[string]interface{}) (HttpFilter, error)
Apply return a new filter by name & conf
func (*FilterManager) GetFilters ¶
func (fm *FilterManager) GetFilters() []*HttpFilter
GetFilters get all filter from manager
func (*FilterManager) ReLoad ¶
func (fm *FilterManager) ReLoad(filters []*model.HTTPFilter)
ReLoad filter configs
type HttpFilter ¶
type HttpFilter interface { // PrepareFilterChain add filter into chain PrepareFilterChain(ctx *http.HttpContext) error // Handle filter hook function Handle(ctx *http.HttpContext) Apply() error // Config get config for filter Config() interface{} }
HttpFilter describe http filter
type HttpFilterPlugin ¶
type HttpFilterPlugin interface { // Kind returns the unique kind name to represent itself. Kind() string // CreateFilter return the filter callback CreateFilter() (HttpFilter, error) }
HttpFilterPlugin describe plugin
func GetHttpFilterPlugin ¶
func GetHttpFilterPlugin(kind string) (HttpFilterPlugin, error)
GetHttpFilterPlugin get plugin by kind
type NetworkFilter ¶
type NetworkFilter interface { // OnData handle the http context from worker OnData(hc *http.HttpContext) error }
NetworkFilter describe network filter
type NetworkFilterPlugin ¶
type NetworkFilterPlugin interface { // Kind returns the unique kind name to represent itself. Kind() string // CreateFilterFactory return the filter callback CreateFilter(config interface{}, bs *model.Bootstrap) (NetworkFilter, error) }
NetworkFilter describe network filter plugin
func GetNetworkFilterPlugin ¶
func GetNetworkFilterPlugin(kind string) (NetworkFilterPlugin, error)
GetNetworkFilterPlugin get plugin by kind
Click to show internal directories.
Click to hide internal directories.