Documentation
¶
Overview ¶
Package stats provides units for managing statistics of the filtering DNS server.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Filename string // database file name
LimitDays uint32 // time limit (in days)
UnitID unitIDCallback // user function to get the current unit ID. If nil, the current time hour is used.
AnonymizeClientIP bool // anonymize clients' IP addresses
// Called when the configuration is changed by HTTP request
ConfigModified func()
// Register an HTTP handler
HTTPRegister func(string, string, func(http.ResponseWriter, *http.Request))
// contains filtered or unexported fields
}
Config - module configuration
type DiskConfig ¶
type DiskConfig struct {
Interval uint32 `yaml:"statistics_interval"` // time interval for statistics (in days)
}
DiskConfig - configuration settings that are stored on disk
type Entry ¶
type Entry struct {
// Clients is the client's primary ID.
//
// TODO(a.garipov): Make this a {net.IP, string} enum?
Client string
Domain string
Result Result
Time uint32 // processing time (msec)
}
Entry is a statistics data entry.
type Stats ¶
type Stats interface {
Start()
// Close object.
// This function is not thread safe
// (can't be called in parallel with any other function of this interface).
Close()
// Update counters
Update(e Entry)
// Get IP addresses of the clients with the most number of requests
GetTopClientsIP(limit uint) []net.IP
// WriteDiskConfig - write configuration
WriteDiskConfig(dc *DiskConfig)
}
Stats - main interface
Click to show internal directories.
Click to hide internal directories.