filters

package
v1.8.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 23, 2020 License: Apache-2.0 Imports: 13 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

DefaultFilters is the list of default filters

Functions

func Apply

func Apply(whitelist, blacklist FilterFuncs, ev *v1.Event) bool

Apply filters the flow with the given white- and blacklist. Returns true if the flow should be included in the result.

Types

type EventTypeFilter

type EventTypeFilter struct{}

EventTypeFilter implements filtering based on event type

func (*EventTypeFilter) OnBuildFilter

func (e *EventTypeFilter) OnBuildFilter(ctx context.Context, ff *flowpb.FlowFilter) ([]FilterFunc, error)

OnBuildFilter builds an event type filter

type FQDNFilter

type FQDNFilter struct{}

FQDNFilter implements filtering based on FQDN information

func (*FQDNFilter) OnBuildFilter

func (f *FQDNFilter) OnBuildFilter(ctx context.Context, ff *flowpb.FlowFilter) ([]FilterFunc, error)

OnBuildFilter builds a FQDN filter

type FilterFunc

type FilterFunc func(ev *v1.Event) bool

FilterFunc is the function will be used to filter the given data. Should return true if the filter is hit, false otherwise.

func FilterByLabelSelectors

func FilterByLabelSelectors(labelSelectors []string, getLabels func(*v1.Event) k8sLabels.Labels) (FilterFunc, error)

FilterByLabelSelectors returns a FilterFunc. The FilterFunc returns true if and only if any of the specified selectors select the event. The caller specifies how to extract labels from the event.

type FilterFuncs

type FilterFuncs []FilterFunc

FilterFuncs is a combination of multiple filters, typically applied together.

func BuildFilter

func BuildFilter(ctx context.Context, ff *flowpb.FlowFilter, auxFilters []OnBuildFilter) (FilterFuncs, error)

BuildFilter builds a filter based on a FlowFilter. It returns:

  • the FilterFunc to be used to filter packets based on the requested FlowFilter;
  • an error in case something went wrong.

func BuildFilterList

func BuildFilterList(ctx context.Context, ff []*flowpb.FlowFilter, auxFilters []OnBuildFilter) (FilterFuncs, error)

BuildFilterList constructs a list of filter functions representing the list of FlowFilter. It returns:

  • the FilterFunc to be used to filter packets based on the requested FlowFilter;
  • an error in case something went wrong.

func (FilterFuncs) MatchAll

func (fs FilterFuncs) MatchAll(ev *v1.Event) bool

MatchAll returns true if all the filters match the provided data, i.e. AND.

func (FilterFuncs) MatchNone

func (fs FilterFuncs) MatchNone(ev *v1.Event) bool

MatchNone returns true if none of the filters match the provided data or if no filters are specified, i.e. NOR

func (FilterFuncs) MatchOne

func (fs FilterFuncs) MatchOne(ev *v1.Event) bool

MatchOne returns true if at least one of the filters match the provided data or if no filters are specified, i.e. OR.

type HTTPFilter

type HTTPFilter struct{}

HTTPFilter implements filtering based on HTTP metadata

func (*HTTPFilter) OnBuildFilter

func (h *HTTPFilter) OnBuildFilter(ctx context.Context, ff *flowpb.FlowFilter) ([]FilterFunc, error)

OnBuildFilter builds a HTTP filter

type IPFilter

type IPFilter struct{}

IPFilter implements IP addressing filtering for the source and destination address

func (*IPFilter) OnBuildFilter

func (f *IPFilter) OnBuildFilter(ctx context.Context, ff *flowpb.FlowFilter) ([]FilterFunc, error)

OnBuildFilter builds an IP address filter

type IdentityFilter

type IdentityFilter struct{}

IdentityFilter implements filtering based on security identity

func (*IdentityFilter) OnBuildFilter

func (i *IdentityFilter) OnBuildFilter(ctx context.Context, ff *flowpb.FlowFilter) ([]FilterFunc, error)

OnBuildFilter builds a security identity filter

type LabelsFilter

type LabelsFilter struct{}

LabelsFilter implements filtering based on labels

func (*LabelsFilter) OnBuildFilter

func (l *LabelsFilter) OnBuildFilter(ctx context.Context, ff *flowpb.FlowFilter) ([]FilterFunc, error)

OnBuildFilter builds a labels filter

type OnBuildFilter

type OnBuildFilter interface {
	OnBuildFilter(context.Context, *flowpb.FlowFilter) ([]FilterFunc, error)
}

OnBuildFilter is invoked while building a flow filter

type OnBuildFilterFunc

type OnBuildFilterFunc func(context.Context, *flowpb.FlowFilter) ([]FilterFunc, error)

OnBuildFilterFunc implements OnBuildFilter for a single function

func (OnBuildFilterFunc) OnBuildFilter

func (f OnBuildFilterFunc) OnBuildFilter(ctx context.Context, flow *flowpb.FlowFilter) ([]FilterFunc, error)

OnBuildFilter is invoked while building a flow filter

type PodFilter

type PodFilter struct{}

PodFilter implements filtering based on Kubernetes pod names

func (*PodFilter) OnBuildFilter

func (p *PodFilter) OnBuildFilter(ctx context.Context, ff *flowpb.FlowFilter) ([]FilterFunc, error)

OnBuildFilter builds a Kubernetes pod name filter

type PortFilter

type PortFilter struct{}

PortFilter implements filtering based on L4 port numbers

func (*PortFilter) OnBuildFilter

func (p *PortFilter) OnBuildFilter(ctx context.Context, ff *flowpb.FlowFilter) ([]FilterFunc, error)

OnBuildFilter builds a L4 port filter

type ProtocolFilter

type ProtocolFilter struct{}

ProtocolFilter implements filtering based on L4 protocol

func (*ProtocolFilter) OnBuildFilter

func (p *ProtocolFilter) OnBuildFilter(ctx context.Context, ff *flowpb.FlowFilter) ([]FilterFunc, error)

OnBuildFilter builds a L4 protocol filter

type ReplyFilter

type ReplyFilter struct{}

ReplyFilter implements filtering for reply flows

func (*ReplyFilter) OnBuildFilter

func (r *ReplyFilter) OnBuildFilter(ctx context.Context, ff *flowpb.FlowFilter) ([]FilterFunc, error)

OnBuildFilter builds a reply filter

type ServiceFilter

type ServiceFilter struct{}

ServiceFilter implements filtering based on Kubernetes service names

func (*ServiceFilter) OnBuildFilter

func (s *ServiceFilter) OnBuildFilter(ctx context.Context, ff *flowpb.FlowFilter) ([]FilterFunc, error)

OnBuildFilter builds a Kubernetes service name filter

type VerdictFilter

type VerdictFilter struct{}

VerdictFilter implements filtering based on forwarding verdict

func (*VerdictFilter) OnBuildFilter

func (v *VerdictFilter) OnBuildFilter(ctx context.Context, ff *flowpb.FlowFilter) ([]FilterFunc, error)

OnBuildFilter builds a forwarding verdict filter

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL