adguard-exporter/internal/adguard/model.go

22 lines
952 B
Go
Raw Normal View History

2020-11-01 22:09:36 +00:00
package adguard
import "fmt"
2020-11-02 18:10:20 +00:00
// Stats struct is the Adguard statistics JSON API corresponding model.
2020-11-01 22:09:36 +00:00
type Stats struct {
2020-11-02 18:19:37 +00:00
AvgProcessingTime float64 `json:"avg_processing_time"`
DnsQueries int `json:"num_dns_queries"`
BlockedFiltering int `json:"num_blocked_filtering"`
ParentalFiltering int `json:"num_replaced_parental"`
SafeBrowsingFiltering int `json:"num_replaced_safebrowsing"`
SafeSearchFiltering int `json:"num_replaced_safesearch"`
TopQueries []map[string]int `json:"top_queried_domains"`
TopBlocked []map[string]int `json:"top_blocked_domains"`
TopClients []map[string]int `json:"top_clients"`
2020-11-01 22:09:36 +00:00
}
// ToString method returns a string of the current statistics struct.
func (s *Stats) ToString() string {
2020-11-02 18:19:37 +00:00
return fmt.Sprintf("%d ads blocked / %d total DNS queries", s.BlockedFiltering, s.DnsQueries)
}