rulestat

package
v0.0.0-...-b6e3791 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2024 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Package rulestat contains the filtering rule statistics collector and API.

Index

Constants

View Source
const StatFilterListID agd.FilterListID = "adguard_dns_filter"

StatFilterListID is the ID of the filtering rule list for which we collect statistics. This is a temporary restriction.

TODO(ameshkov): Consider making configurable

View Source
const StatFilterListLegacyID agd.FilterListID = "15"

StatFilterListLegacyID is the ID of the filtering rule list for which we collect statistics, as understood and accepted by the current backend. This is a temporary restriction.

TODO(ameshkov): Consider making the backend accept the current IDs.

Variables

This section is empty.

Functions

This section is empty.

Types

type Empty

type Empty struct{}

Empty is an Interface implementation that does nothing.

func (Empty) Collect

Collect implements the Interface interface for Empty.

type HTTP

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

HTTP is the filtering rule statistics collector that uploads the statistics to the given URL when it's refreshed.

TODO(a.garipov): Add tests.

func NewHTTP

func NewHTTP(c *HTTPConfig) (s *HTTP)

NewHTTP returns a new statistics collector with HTTP upload.

func (*HTTP) Collect

func (s *HTTP) Collect(_ context.Context, id agd.FilterListID, text agd.FilterRuleText)

Collect implements the Interface interface for *HTTP.

func (*HTTP) Refresh

func (s *HTTP) Refresh(ctx context.Context) (err error)

Refresh implements the agdservice.Refresher interface for *HTTP. It uploads the collected statistics to s.u and starts collecting a new set of statistics.

type HTTPConfig

type HTTPConfig struct {
	// URL is the URL to which the statistics is uploaded.
	URL *url.URL
}

HTTPConfig is the configuration structure for the filtering rule statistics collector that uploads the statistics to a URL. All fields are required.

type Interface

type Interface interface {
	Collect(ctx context.Context, id agd.FilterListID, r agd.FilterRuleText)
}

Interface is an ephemeral storage of the filtering rule list statistics interface.

All methods must be safe for concurrent use.

Jump to

Keyboard shortcuts

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