bindings

package
v0.0.0-...-7cdc85d Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AggregateDrainFetcher

type AggregateDrainFetcher struct {
	// contains filtered or unexported fields
}

func NewAggregateDrainFetcher

func NewAggregateDrainFetcher(bindings []string, cf CacheFetcher) *AggregateDrainFetcher

func (*AggregateDrainFetcher) DrainLimit

func (a *AggregateDrainFetcher) DrainLimit() int

func (*AggregateDrainFetcher) FetchBindings

func (a *AggregateDrainFetcher) FetchBindings() ([]syslog.Binding, error)

type BindingFetcher

type BindingFetcher struct {
	// contains filtered or unexported fields
}

BindingFetcher uses a Getter to fetch and decode Bindings

func NewBindingFetcher

func NewBindingFetcher(limit int, g Getter, m Metrics, logger *log.Logger) *BindingFetcher

NewBindingFetcher returns a new BindingFetcher

func (*BindingFetcher) DrainLimit

func (f *BindingFetcher) DrainLimit() int

func (*BindingFetcher) FetchBindings

func (f *BindingFetcher) FetchBindings() ([]syslog.Binding, error)

FetchBindings reaches out to the syslog drain binding provider via the Getter and decodes the response. If it does not get a 200, it returns an error.

type BlacklistRange

type BlacklistRange struct {
	Start string
	End   string
}

type BlacklistRanges

type BlacklistRanges struct {
	Ranges []BlacklistRange
}

func NewBlacklistRanges

func NewBlacklistRanges(ranges ...BlacklistRange) (*BlacklistRanges, error)

func (*BlacklistRanges) CheckBlacklist

func (i *BlacklistRanges) CheckBlacklist(ip net.IP) error

func (*BlacklistRanges) ResolveAddr

func (i *BlacklistRanges) ResolveAddr(host string) (net.IP, error)

func (*BlacklistRanges) UnmarshalEnv

func (i *BlacklistRanges) UnmarshalEnv(v string) error

UnmarshalEnv implements envstruct.Unmarshaller. Example input: 10.0.0.5-10.0.0.9,123.4.5.6-123.4.5.7

type ByUrl

type ByUrl []syslog.Drain

func (ByUrl) Len

func (b ByUrl) Len() int

func (ByUrl) Less

func (b ByUrl) Less(i, j int) bool

func (ByUrl) Swap

func (b ByUrl) Swap(i, j int)

type CacheFetcher

type CacheFetcher interface {
	GetAggregate() ([]binding.Binding, error)
}

type DrainParamParser

type DrainParamParser struct {
	// contains filtered or unexported fields
}

func NewDrainParamParser

func NewDrainParamParser(f binding.Fetcher, defaultDrainMetadata bool) *DrainParamParser

func (*DrainParamParser) DrainLimit

func (d *DrainParamParser) DrainLimit() int

func (*DrainParamParser) FetchBindings

func (d *DrainParamParser) FetchBindings() ([]syslog.Binding, error)

type FilteredBindingFetcher

type FilteredBindingFetcher struct {
	// contains filtered or unexported fields
}

func NewFilteredBindingFetcher

func NewFilteredBindingFetcher(c IPChecker, b binding.Fetcher, m metricsClient, warn bool, lc *log.Logger) *FilteredBindingFetcher

func (FilteredBindingFetcher) DrainLimit

func (f FilteredBindingFetcher) DrainLimit() int

func (*FilteredBindingFetcher) FetchBindings

func (f *FilteredBindingFetcher) FetchBindings() ([]syslog.Binding, error)

type Getter

type Getter interface {
	Get() ([]binding.Binding, error)
}

Getter is configured to fetch HTTP responses

type IPChecker

type IPChecker interface {
	ResolveAddr(host string) (net.IP, error)
	CheckBlacklist(ip net.IP) error
}

type Metrics

type Metrics interface {
	NewGauge(name, helpText string, opts ...metrics.MetricOption) metrics.Gauge
	NewCounter(name, helpText string, opts ...metrics.MetricOption) metrics.Counter
}

Metrics is the client used to expose gauge and counter metricsClient.

Jump to

Keyboard shortcuts

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