Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrRequiredField is an error for required field. ErrRequiredField = errors.New("required field is empty") // ErrDenyInterval is an error for deny interval, too short or too long. ErrDenyInterval = errors.New("deny interval") // ErrDuplicate is an error for duplicated value. ErrDuplicate = errors.New("duplicate error") // ErrParse is an error for parsing error. ErrParse = errors.New("parse error") )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Host string `json:"host"` Port uint16 `json:"port"` UserAgent string `json:"user_agent"` Timeout Duration `json:"timeout"` Root string `json:"root"` Retries uint8 `json:"retries"` Limiter LimitOptions `json:"limiter"` Debug bool `json:"debug"` Groups []Group `json:"groups"` }
Config is a main configuration structure.
func (*Config) GroupsEndpoints ¶ added in v1.1.4
GroupsEndpoints returns a map of groups by their endpoints.
type Duration ¶
Duration is a wrapper around time.Duration that supports unmarshalling from a JSON string.
func (*Duration) MarshalJSON ¶
MarshalJSON returns a JSON representation of the Duration type.
func (*Duration) UnmarshalJSON ¶
UnmarshalJSON parses a JSON string into a Duration type.
type Group ¶
type Group struct { Name string `json:"name"` Endpoint string `json:"endpoint"` Encoded bool `json:"encoded"` Period Duration `json:"period"` Subscriptions []Subscription `json:"subscriptions"` }
Group is a collection of subscriptions.
func (*Group) MaxSubscriptionTimeout ¶ added in v1.0.3
MaxSubscriptionTimeout returns the maximum timeout of all subscriptions in the group.
type LimitOptions ¶ added in v1.8.0
type LimitOptions struct { MaxConcurrent uint32 `json:"max_concurrent"` Rate float64 `json:"rate"` Burst float64 `json:"burst"` Interval Duration `json:"interval"` CleanInterval Duration `json:"clean_interval"` Exclude []string `json:"exclude"` // contains filtered or unexported fields }
LimitOptions is a rate limiter configuration.
func (*LimitOptions) ExcludedIPS ¶ added in v1.8.0
func (l *LimitOptions) ExcludedIPS() map[string]struct{}
ExcludedIPS returns a map of excluded IPs.
func (*LimitOptions) Validate ¶ added in v1.8.0
func (l *LimitOptions) Validate() error
Validate checks the rate limiter options for correctness.
type Prefixes ¶ added in v1.2.0
type Prefixes []string
Prefixes is a list of prefixes for filtering subscription's values.
type SubPath ¶ added in v1.3.0
type SubPath string
SubPath is a subscription Path or file path string type.
type Subscription ¶
type Subscription struct { Name string `json:"name"` Path SubPath `json:"url"` Encoded bool `json:"encoded"` Timeout Duration `json:"timeout"` HasPrefixes Prefixes `json:"has_prefixes"` Local bool `json:"local"` }
Subscription represents a subscription data.
func (*Subscription) Filter ¶ added in v1.2.1
func (s *Subscription) Filter(subURLs []string) []string
Filter returns a list of URLs filtered by prefixes.
func (*Subscription) Validate ¶
func (s *Subscription) Validate(root string) error
Validate checks the subscription for correctness.