Version: v0.3.0 Latest Latest

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

Go to latest
Published: Feb 20, 2022 License: MIT Imports: 12 Imported by: 0




This section is empty.


This section is empty.


This section is empty.


type Client

type Client struct {
	Status chan *ClientChannel
	// contains filtered or unexported fields

Client struct is a PI-Hole client to request an instance of a PI-Hole ad blocker.

func NewClient

func NewClient(config *config.Config, envConfig *config.EnvConfig) *Client

NewClient method initializes a new PI-Hole client.

func (*Client) CollectMetrics added in v0.1.0

func (c *Client) CollectMetrics(writer http.ResponseWriter, request *http.Request) error

func (*Client) CollectMetricsAsync added in v0.3.0

func (c *Client) CollectMetricsAsync(writer http.ResponseWriter, request *http.Request)

func (*Client) GetHostname added in v0.1.0

func (c *Client) GetHostname() string

func (*Client) String added in v0.1.0

func (c *Client) String() string

type ClientChannel added in v0.3.0

type ClientChannel struct {
	Status ClientStatus
	Err    error

func (*ClientChannel) String added in v0.3.0

func (c *ClientChannel) String() string

type ClientStatus added in v0.3.0

type ClientStatus byte
const (
	MetricsCollectionInProgress ClientStatus = iota

func (ClientStatus) String added in v0.3.0

func (status ClientStatus) String() string

type Stats

type Stats struct {
	DomainsBeingBlocked int                `json:"domains_being_blocked"`
	DNSQueriesToday     int                `json:"dns_queries_today"`
	AdsBlockedToday     int                `json:"ads_blocked_today"`
	AdsPercentageToday  float64            `json:"ads_percentage_today"`
	UniqueDomains       int                `json:"unique_domains"`
	QueriesForwarded    int                `json:"queries_forwarded"`
	QueriesCached       int                `json:"queries_cached"`
	ClientsEverSeen     int                `json:"clients_ever_seen"`
	UniqueClients       int                `json:"unique_clients"`
	DNSQueriesAllTypes  int                `json:"dns_queries_all_types"`
	ReplyNoData         int                `json:"reply_NODATA"`
	ReplyNxDomain       int                `json:"reply_NXDOMAIN"`
	ReplyCname          int                `json:"reply_CNAME"`
	ReplyIP             int                `json:"reply_IP"`
	TopQueries          map[string]int     `json:"top_queries"`
	TopAds              map[string]int     `json:"top_ads"`
	TopSources          map[string]int     `json:"top_sources"`
	ForwardDestinations map[string]float64 `json:"forward_destinations"`
	QueryTypes          map[string]float64 `json:"querytypes"`
	Status              string             `json:"status"`

Stats struct is the PI-Hole statistics JSON API corresponding model.

func (*Stats) String added in v0.1.0

func (s *Stats) String() string

ToString method returns a string of the current statistics struct.

Source Files

Jump to

Keyboard shortcuts

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