Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIClient ¶ added in v1.0.0
type APIClient struct { BaseURL string Client *http.Client // contains filtered or unexported fields }
func NewAPIClient ¶ added in v1.0.0
NewAPIClient initializes and returns a new APIClient.
func (*APIClient) Authenticate ¶ added in v1.0.0
Authenticate logs in and stores the session ID.
type AuthenticationResponse ¶ added in v1.0.0
type BlockingStatus ¶ added in v1.0.0
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 (*Client) CollectMetrics ¶ added in v0.1.0
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
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 MetricsCollectionSuccess MetricsCollectionError MetricsCollectionTimeout )
func (ClientStatus) String ¶ added in v0.3.0
func (status ClientStatus) String() string
type PiHoleClient ¶ added in v1.0.0
type PiHoleClient struct { IP string `json:"ip"` Name string `json:"name"` Count int `json:"count"` }
func MergeClients ¶ added in v1.0.0
func MergeClients(clients1, clients2 []PiHoleClient) []PiHoleClient
type StatsSummary ¶ added in v1.0.0
type StatsSummary struct { Queries struct { Total int `json:"total"` Blocked int `json:"blocked"` PercentBlocked float64 `json:"percent_blocked"` UniqueDomains int `json:"unique_domains"` Forwarded int `json:"forwarded"` Cached int `json:"cached"` Frequency float64 `json:"frequency"` Types map[string]float64 `json:"types"` Status struct { UNKNOWN int `json:"UNKNOWN"` GRAVITY int `json:"GRAVITY"` FORWARDED int `json:"FORWARDED"` CACHE int `json:"CACHE"` REGEX int `json:"REGEX"` DENYLIST int `json:"DENYLIST"` EXTERNALBLOCKEDIP int `json:"EXTERNAL_BLOCKED_IP"` EXTERNALBLOCKEDNULL int `json:"EXTERNAL_BLOCKED_NULL"` EXTERNALBLOCKEDNXRA int `json:"EXTERNAL_BLOCKED_NXRA"` GRAVITYCNAME int `json:"GRAVITY_CNAME"` REGEXCNAME int `json:"REGEX_CNAME"` DENYLISTCNAME int `json:"DENYLIST_CNAME"` RETRIED int `json:"RETRIED"` RETRIEDDNSSEC int `json:"RETRIED_DNSSEC"` INPROGRESS int `json:"IN_PROGRESS"` DBBUSY int `json:"DBBUSY"` SPECIALDOMAIN int `json:"SPECIAL_DOMAIN"` CACHESTALE int `json:"CACHE_STALE"` EXTERNALBLOCKEDEDE15 int `json:"EXTERNAL_BLOCKED_EDE15"` } `json:"status"` Replies struct { UNKNOWN int `json:"UNKNOWN"` NODATA int `json:"NODATA"` NXDOMAIN int `json:"NXDOMAIN"` CNAME int `json:"CNAME"` IP int `json:"IP"` DOMAIN int `json:"DOMAIN"` RRNAME int `json:"RRNAME"` SERVFAIL int `json:"SERVFAIL"` REFUSED int `json:"REFUSED"` NOTIMP int `json:"NOTIMP"` OTHER int `json:"OTHER"` DNSSEC int `json:"DNSSEC"` NONE int `json:"NONE"` BLOB int `json:"BLOB"` } `json:"replies"` } `json:"queries"` Clients struct { Active int `json:"active"` Total int `json:"total"` } `json:"clients"` Gravity struct { DomainsBeingBlocked int `json:"domains_being_blocked"` LastUpdate int `json:"last_update"` } `json:"gravity"` Took float64 `json:"took"` }
func (*StatsSummary) String ¶ added in v1.0.0
func (s *StatsSummary) String() string
ToString method returns a string of the current statistics struct.
type TopClients ¶ added in v1.0.0
type TopClients struct { Clients []PiHoleClient `json:"clients"` TotalQueries int `json:"total_queries"` BlockedQueries int `json:"blocked_queries"` Took float64 `json:"took"` }
Response struct represents the full JSON response
type TopDomains ¶ added in v1.0.0
type Upstreams ¶ added in v1.0.0
type Upstreams struct { Upstreams []struct { IP string `json:"ip"` Name string `json:"name"` Port int `json:"port"` Count int `json:"count"` Statistics struct { Response float64 `json:"response"` Variance float64 `json:"variance"` } `json:"statistics"` } `json:"upstreams"` ForwardedQueries int `json:"forwarded_queries"` TotalQueries int `json:"total_queries"` Took float64 `json:"took"` }
Click to show internal directories.
Click to hide internal directories.