Documentation
¶
Overview ¶
Package statsstore persists per-rule cumulative traffic counters to a JSON file with atomic writes, so daemon restarts do not lose upload, download, source-IP denial, or UDP protection totals. It only stores cumulative values; live connection counts and rates are not persisted.
Index ¶
Constants ¶
const DefaultFilename = "stats.json"
DefaultFilename is the state filename used when no explicit path is set.
const DefaultQuotaFilename = "quota-state.json"
DefaultQuotaFilename is kept separate from cumulative counters because quota enforcement treats corrupt or unwritable state as fatal rather than resetting.
Variables ¶
This section is empty.
Functions ¶
func ResolvePath ¶
ResolvePath returns the stats file path. Explicit relative paths are resolved beside the config file; otherwise a service state directory takes precedence over the config directory.
func SameFilePath ¶
SameFilePath reports whether two paths identify the same destination. It handles existing hard links and symlinks, plus not-yet-created files whose parent directory can be resolved.
Types ¶
type QuotaStore ¶
type QuotaStore struct {
// contains filtered or unexported fields
}
func NewQuotaStore ¶
func NewQuotaStore(path string) *QuotaStore
func (*QuotaStore) LoadQuotaState ¶
func (store *QuotaStore) LoadQuotaState() ([]engine.QuotaPersistentState, error)
func (*QuotaStore) Path ¶
func (store *QuotaStore) Path() string
func (*QuotaStore) SaveQuotaState ¶
func (store *QuotaStore) SaveQuotaState(records []engine.QuotaPersistentState) error
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store reads and writes cumulative traffic counters at path.