Documentation ¶
Index ¶
Constants ¶
View Source
const ( AllQueryDataKey = "data" // The starting setting for the number of queries that are included in the live log DefaultAmountOfQueries = 10 )
View Source
const ( DNSQueriesTodayKey = "dns_queries_today" AdsBlockedTodayKey = "ads_blocked_today" PercentBlockedTodayKey = "ads_percentage_today" DomainsOnBlockListKey = "domains_being_blocked" StatusKey = "status" PrivacyLevelKey = "privacy_level" TotalClientsSeenKey = "clients_ever_seen" )
Keys that can be used to index JSON responses from the Pi-Hole's API
View Source
const ( TopQueriesTodayKey = "top_queries" TopAdsTodayKey = "top_ads" )
Keys that can be used to index JSON responses from the Pi-Hole's API
Variables ¶
View Source
var LiveAllQueries = NewAllQueries()
instance of AllQueries used at runtime
View Source
var LiveSummary = NewSummary()
View Source
var LiveTopItems = NewTopItems()
Instance of TopItems used at runtime
Functions ¶
Types ¶
type AllQueries ¶
type AllQueries struct { // Slice of Query structs Queries []Query // The amount of queries being stored in the log AmountOfQueriesInLog int // The queries stored in a format able to be displayed as a table Table []string }
Holds a slice of query structs
func (*AllQueries) Update ¶
func (allQueries *AllQueries) Update(wg *sync.WaitGroup)
Updates the all queries list with up to date information from the Pi-Hole
type Query ¶
type Query struct { // UNIX timestamp of when the query was logged UnixTime string // The type of query QueryType string // The domain the query was sent to Domain string // The client that sent the query OriginClient string // Where the query was forwarded to ForwardedTo string }
Holds information about a single query logged by Pi-Hole
type Summary ¶
type Summary struct { // Total number of queries logged today QueriesToday string // Total number of queries blocked today BlockedToday string // Percentage of today's queries that have been blocked PercentBlockedToday string // How large is Pi-Hole's active blocklist? DomainsOnBlocklist string // Enabled vs. disabled Status string // Pi-Hole's current data privacy level PrivacyLevel string // Mapping between privacy level numbers and their meanings PrivacyLevelNumberMapping map[string]string // The total number of clients that the Pi-Hole has seen TotalClientsSeen string }
Summary holds things that do not require authentication to retrieve
func NewSummary ¶
func NewSummary() *Summary
Returns a new Summary instance with default values for all fields
type TopItems ¶
type TopItems struct { // Mapping of top DNS queried domains and their occurrences TopQueries map[string]int // Mapping of top blocked DNS domains (ads and/or tracking) and their occurrences TopAds map[string]int // Pretty list version of TopQueries PrettyTopQueries []string // Pretty list version of TopAds PrettyTopAds []string }
TopItems stores top permitted domains and top blocked domains (requires authentication to retrieve)
Click to show internal directories.
Click to hide internal directories.