Documentation
¶
Overview ¶
Package xlistd and subpackages implements a blacklist aggregator.
This package is a work in progress and makes no API stability promises.
Index ¶
- Variables
- func RegisterListBuilder(class string, builder BuildListFn)
- func RegisterWrapperBuilder(class string, builder BuildWrapperFn)
- type BuildListFn
- type BuildWrapperFn
- type Builder
- func (b Builder) APIService(name string) (apiservice.Service, bool)
- func (b *Builder) Build(def ListDef) (List, error)
- func (b *Builder) BuildChild(parents []string, def ListDef) (List, error)
- func (b Builder) CertPath(cert string) string
- func (b Builder) DataPath(source string) string
- func (b *Builder) List(id string) (List, bool)
- func (b Builder) Logger() yalogi.Logger
- func (b *Builder) OnShutdown(f func() error)
- func (b *Builder) OnStartup(f func() error)
- func (b *Builder) Shutdown() error
- func (b *Builder) Start() error
- type BuilderOption
- type Category
- type Format
- type List
- type ListDef
- func FilterCategory(c Category, l []ListDef) []ListDef
- func FilterClass(c string, l []ListDef) []ListDef
- func FilterID(id string, l []ListDef) (ListDef, bool)
- func FilterResource(r xlist.Resource, l []ListDef) []ListDef
- func FilterTag(tag string, l []ListDef) []ListDef
- func ListDefsFromFile(path string) ([]ListDef, error)
- type ListDefsByID
- type ListDefsByName
- type WrapperDef
Constants ¶
This section is empty.
Variables ¶
Categories is a vector that constains all category types.
var ErrListRemoved = errors.New("removed from database, update your config")
ErrListRemoved is used when a list is marked as removed
Functions ¶
func RegisterListBuilder ¶
func RegisterListBuilder(class string, builder BuildListFn)
RegisterListBuilder registers a list builder for a class name
func RegisterWrapperBuilder ¶
func RegisterWrapperBuilder(class string, builder BuildWrapperFn)
RegisterWrapperBuilder registers a wrapper builder for a class name
Types ¶
type BuildListFn ¶
BuildListFn defines a function that constructs a checker.
type BuildWrapperFn ¶
type BuildWrapperFn func(builder *Builder, def WrapperDef, list List) (List, error)
BuildWrapperFn defines a function that constructs a wrapper and returns the checker wrapped.
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder constructs RBL services.
func NewBuilder ¶
func NewBuilder(services apiservice.Discover, opt ...BuilderOption) *Builder
NewBuilder instances a new builder.
func (Builder) APIService ¶
func (b Builder) APIService(name string) (apiservice.Service, bool)
APIService returns service by name
func (*Builder) BuildChild ¶
BuildChild allows to create child list for composed RBL. Parameter parents is an array with the parents ID and is used for looping detection.
func (*Builder) OnShutdown ¶
OnShutdown registers the functions that will be executed during shutdown.
type BuilderOption ¶
type BuilderOption func(*builderOpts)
BuilderOption is used for builder configuration.
func SetLogger ¶
func SetLogger(l yalogi.Logger) BuilderOption
SetLogger option sets a logger for the component.
type Category ¶
type Category int
Category type is used for RBL classification.
const ( Blacklist Category = iota //blacklist Whitelist //whitelist Mixedlist //mixed Infolist //information )
Constants used for categories allowed.
func ToCategory ¶
ToCategory returns the category from its string representation.
func (Category) MarshalJSON ¶
MarshalJSON implements interface for struct marshalling.
func (*Category) UnmarshalJSON ¶
UnmarshalJSON implements interface for struct unmarshalling.
type Format ¶
type Format int
Format stores the type of available formats for lists.
type ListDef ¶
type ListDef struct {
// ID must exist and be unique in databases for its correct operation
ID string `json:"id"`
// Class stores the component type of the RBL
Class string `json:"class"`
// Disabled flag
Disabled bool `json:"disabled,omitempty"`
// Removed flag
Removed bool `json:"removed,omitempty"`
// Deprecated flag
Deprecated bool `json:"deprecated,omitempty"`
// Name or description of the list
Name string `json:"name,omitempty"`
// Category of the list
Category Category `json:"category"`
// Tags associated with the list
Tags []string `json:"tags,omitempty"`
// Resources is a list of the recource types supported
Resources []xlist.Resource `json:"resources,omitempty"`
// Web provides the website of the RBL
Web string `json:"web,omitempty"`
// Source provides the origin of the RBL
Source string `json:"source,omitempty"`
// Client configuration
Client *grpctls.ClientCfg `json:"tls,omitempty"`
// Wrappers definition of the list
Wrappers []WrapperDef `json:"wrappers,omitempty"`
// Contains stores child RBLs
Contains []ListDef `json:"contains,omitempty"`
// Opts custom options of the RBL
Opts map[string]interface{} `json:"opts,omitempty"`
}
ListDef stores metadata info about RBL services. It's used by Builder type to build generic Check interfaces.
func FilterCategory ¶
FilterCategory returns all listdefs of the category.
func FilterClass ¶
FilterClass returns all listdefs that correspond to the class passed.
func FilterResource ¶
FilterResource returns all listdefs that provides support for the resource passed.
func FilterTag ¶
FilterTag returns all listdefs that contains the tag. If tag is empty it will return lists with no tags.
func ListDefsFromFile ¶
ListDefsFromFile creates a slice of ListDef from a file in json format.
type ListDefsByID ¶
type ListDefsByID []ListDef
ListDefsByID implements sort.Interface based on the ID field
func (ListDefsByID) Len ¶
func (a ListDefsByID) Len() int
func (ListDefsByID) Less ¶
func (a ListDefsByID) Less(i, j int) bool
func (ListDefsByID) Swap ¶
func (a ListDefsByID) Swap(i, j int)
type ListDefsByName ¶
type ListDefsByName []ListDef
ListDefsByName implements sort.Interface based on the Name field
func (ListDefsByName) Len ¶
func (a ListDefsByName) Len() int
func (ListDefsByName) Less ¶
func (a ListDefsByName) Less(i, j int) bool
func (ListDefsByName) Swap ¶
func (a ListDefsByName) Swap(i, j int)
type WrapperDef ¶
type WrapperDef struct {
// Class stores the component type of the Wrapper
Class string `json:"class"`
// Opts custom options of the wrapper
Opts map[string]interface{} `json:"opts,omitempty"`
}
WrapperDef stores metadata info about wrappers. Wrappers are used for provide additional funtionality to RBLs.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
components
|
|
|
apicheckxl
Package apicheckxl provides a xlistd.List implementation that uses an xlist.Check api service for its checks.
|
Package apicheckxl provides a xlistd.List implementation that uses an xlist.Check api service for its checks. |
|
dnsxl
Package dnsxl provides a xlistd.List implementation that uses a dns zone as a source for its checks.
|
Package dnsxl provides a xlistd.List implementation that uses a dns zone as a source for its checks. |
|
filexl
Package filexl provides a xlistd.List implementation that uses a file as source for its checks.
|
Package filexl provides a xlistd.List implementation that uses a file as source for its checks. |
|
geoip2xl
Package geoip2xl provides a xlistd.List implementation that uses a geoip database for checks.
|
Package geoip2xl provides a xlistd.List implementation that uses a geoip database for checks. |
|
grpcxl
Package grpcxl provides a xlistd.List implementation that uses a remote xlist.Check service as source.
|
Package grpcxl provides a xlistd.List implementation that uses a remote xlist.Check service as source. |
|
memxl
Package memxl provides a xlistd.List implementation that uses main memory for storage.
|
Package memxl provides a xlistd.List implementation that uses main memory for storage. |
|
mockxl
Package mockxl provides a simple xlist.List implementation that can be used to test other components or test configurations.
|
Package mockxl provides a simple xlist.List implementation that can be used to test other components or test configurations. |
|
parallelxl
Package parallelxl provides a simple xlistd.List implementation that can be used to check in parallel on the child components.
|
Package parallelxl provides a simple xlistd.List implementation that can be used to check in parallel on the child components. |
|
sblookupxl
Package sblookupxl provides a xlistd.List implementation that uses google safe browsing api as source.
|
Package sblookupxl provides a xlistd.List implementation that uses google safe browsing api as source. |
|
selectorxl
Package selectorxl provides a simple xlist.Checker implementation that can be used to select the component defined to the requested resource.
|
Package selectorxl provides a simple xlist.Checker implementation that can be used to select the component defined to the requested resource. |
|
sequencexl
Package sequencexl provides a simple xlistd.List implementation that can be used to check in sequence on the child components.
|
Package sequencexl provides a simple xlistd.List implementation that can be used to check in sequence on the child components. |
|
wbeforexl
Package wbeforexl provides a simple xlistd.List implementation that can be used to check on a white list before checking on a blacklist.
|
Package wbeforexl provides a simple xlistd.List implementation that can be used to check on a white list before checking on a blacklist. |
|
wrappers
|
|
|
cachewr
Package cachewr provides a wrapper for RBLs that implements a memory cache system.
|
Package cachewr provides a wrapper for RBLs that implements a memory cache system. |
|
loggerwr
Package loggerwr provides a wrapper for RBLs that implements a logging system.
|
Package loggerwr provides a wrapper for RBLs that implements a logging system. |
|
metricswr
Package metricswr provides a wrapper for RBLs that implements prometheus metrics.
|
Package metricswr provides a wrapper for RBLs that implements prometheus metrics. |
|
policywr
Package policywr provides a wrapper for RBLs that inserts policies into responses.
|
Package policywr provides a wrapper for RBLs that inserts policies into responses. |
|
responsewr
Package responsewr provides a wrapper for RBLs that changes the responses.
|
Package responsewr provides a wrapper for RBLs that changes the responses. |
|
scorewr
Package scorewr provides a wrapper for RBLs that inserts scores into responses.
|
Package scorewr provides a wrapper for RBLs that inserts scores into responses. |
|
timeoutwr
Package timeoutwr provides a wrapper for RBLs that sets a timeout in the check resquests.
|
Package timeoutwr provides a wrapper for RBLs that sets a timeout in the check resquests. |