Documentation
¶
Overview ¶
Package filter contains definitions for NS1 filter chains.
Index ¶
- type Config
- type Filter
- func NewGeofenceCountry(rmNoLoc bool) *Filter
- func NewGeofenceRegional(rmNoGeo bool) *Filter
- func NewGeotargetCountry() *Filter
- func NewGeotargetLatLong() *Filter
- func NewGeotargetRegional() *Filter
- func NewIPv4PrefixShuffle(n int) *Filter
- func NewNetfenceASN(rmNoASN bool) *Filter
- func NewNetfencePrefix(rmNoIPPrefix bool) *Filter
- func NewPriority() *Filter
- func NewSelFirstN(n int) *Filter
- func NewSelFirstRegion() *Filter
- func NewShedLoad(metric string) *Filter
- func NewShuffle() *Filter
- func NewSticky(byNetwork bool) *Filter
- func NewStickyRegion(byNetwork bool) *Filter
- func NewUp() *Filter
- func NewWeightedShuffle() *Filter
- func NewWeightedSticky(byNetwork bool) *Filter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config map[string]interface{}
Config is a flat mapping where values are simple (no slices/maps).
type Filter ¶
type Filter struct { Type string `json:"filter"` Disabled bool `json:"disabled,omitempty"` Config Config `json:"config"` }
Filter wraps the values of a Record's "filters" attribute
func NewGeofenceCountry ¶
NewGeofenceCountry returns a filter that fences using "country", "us_state", and "ca_province" metadata fields in answers. Only answers in the same country/state/province as the user (or answers with no specified location) are returned. rmNoLoc determines whether to remove answers without location on any match.
func NewGeofenceRegional ¶
NewGeofenceRegional returns a filter that restricts to answers in same geographical region as requester. rmNoGeo determines whether to remove answers without georegion on any match.
func NewGeotargetCountry ¶
func NewGeotargetCountry() *Filter
NewGeotargetCountry returns a filter that sorts answers by distance to requester by country, US state, and/or Canadian province.
func NewGeotargetLatLong ¶
func NewGeotargetLatLong() *Filter
NewGeotargetLatLong returns a filter that sorts answers by distance to user using lat/long.
func NewGeotargetRegional ¶
func NewGeotargetRegional() *Filter
NewGeotargetRegional returns a filter that sorts answers by distance to user by geographical region.
func NewIPv4PrefixShuffle ¶
NewIPv4PrefixShuffle returns a filter that randomly selects IPv4 addresses from prefix list. This filter can only be used A records. n is the number of IPs to randomly select per answer.
func NewNetfenceASN ¶
NewNetfenceASN returns a filter that restricts to answers where the ASN of requester IP matches ASN list. rmNoASN determines whether to remove answers without asn list on any match.
func NewNetfencePrefix ¶
NewNetfencePrefix returns a filter that restricts to answers where requester IP matches prefix list. rmNoIPPrefix determines whether to remove answers without ip prefixes on any match.
func NewPriority ¶
func NewPriority() *Filter
NewPriority returns a filter that fails over according to prioritized answer tiers.
func NewSelFirstN ¶
NewSelFirstN returns a filter that eliminates all but the first N answers from the list.
func NewSelFirstRegion ¶
func NewSelFirstRegion() *Filter
NewSelFirstRegion returns a filter that keeps only the answers that are in the same region as the first answer.
func NewShedLoad ¶
NewShedLoad returns a filter that "sheds" traffic to answers based on load, using one of several load metrics. You must set values for low_watermark, high_watermark, and the configured load metric, for each answer you intend to subject to load shedding.
func NewShuffle ¶
func NewShuffle() *Filter
NewShuffle returns a filter that randomly sorts the answers.
func NewSticky ¶
NewSticky returns a filter that sorts answers uniquely depending on the IP address of the requester. The same requester always gets the same ordering of answers. byNetwork indicates whether to apply the 'stickyness' by subnet(not individual IP).
func NewStickyRegion ¶
NewStickyRegion first sorts regions uniquely depending on the IP address of the requester, and then groups all answers together by region. The same requester always gets the same ordering of regions, but answers within each region may be in any order. byNetwork indicates whether to apply the 'stickyness' by subnet(not individual IP).
func NewUp ¶
func NewUp() *Filter
NewUp returns a filter that eliminates all answers where the 'up' metadata field is not true.
func NewWeightedShuffle ¶
func NewWeightedShuffle() *Filter
NewWeightedShuffle returns a filter that shuffles answers randomly based on their weight.
func NewWeightedSticky ¶
NewWeightedSticky returns a filter that shuffles answers randomly per-requester based on weight. byNetwork indicates whether to apply the 'stickyness' by subnet(not individual IP).