pihole

package
v0.0.0-...-bb60f61 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package pihole contains utilities for interacting with the pihole admin API.

Index

Constants

This section is empty.

Variables

View Source
var ErrStatus = errors.New("unexpected status code")

ErrStatus is the error given when an HTTP call to the pihole returns an error status code.

Functions

This section is empty.

Types

type PiHole

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

The PiHole type is the API interface for a running pihole instance.

func New

func New(urlStr string) (*PiHole, error)

New creates a new instance of the PiHole type that will make requests against the given url.

func (*PiHole) Ping

func (pi *PiHole) Ping() error

Ping returns a non-nil error if the pihole appears to be down.

func (*PiHole) Summary

func (pi *PiHole) Summary(ctx context.Context) (Summary, error)

Summary returns the pihole summary.

type Summary

type Summary struct {
	AdsBlocked       float64 `json:"ads_blocked_today"`
	AdsPercentage    float64 `json:"ads_percentage_today"`
	ClientsEverSeen  float64 `json:"clients_ever_seen"`
	DNSQueries       float64 `json:"dns_queries_today"`
	DomainsBlocked   float64 `json:"domains_being_blocked"`
	QueriesCached    float64 `json:"queries_cached"`
	QueriesForwarded float64 `json:"queries_forwarded"`
	Status           string  `json:"status"`
	UniqueClients    float64 `json:"unique_clients"`
	UniqueDomains    float64 `json:"unique_domains"`
}

The Summary type contains the summary returned by the pihole instance.

Jump to

Keyboard shortcuts

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