fwstats

package
v0.3.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 10, 2026 License: Apache-2.0 Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package fwstats collects firewall visibility from agent heartbeats (§8.3): per-rule hit counters, dropped connection attempts (the drop log) and nodes where security groups cannot be enforced.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Drop

type Drop struct {
	At        time.Time `json:"at"`
	Node      string    `json:"node"`
	Direction string    `json:"direction"` // host | in | out
	Src       string    `json:"src"`
	SrcName   string    `json:"srcName,omitempty"`
	Dst       string    `json:"dst,omitempty"`
	DstName   string    `json:"dstName,omitempty"`
	Protocol  string    `json:"protocol"`
	Port      uint32    `json:"port"`
	Packets   uint64    `json:"packets"`
}

Drop is a dropped flow seen by one node, with names for its addresses.

type DropFilter

type DropFilter struct {
	Node, Direction, IP string
	Since               time.Time
}

DropFilter selects drops; empty fields match everything.

type Stats

type Stats struct {
	// contains filtered or unexported fields
}

Stats is fed by heartbeats and read by the API.

func New

func New(st *store.Store, m *metrics.Store, l *logs.Store, log *slog.Logger) *Stats

func (*Stats) Counters

func (s *Stats) Counters() map[string]firewall.Counts

Counters sums each rule's counters over every node.

func (*Stats) Drops

func (s *Stats) Drops(f DropFilter, limit int) []Drop

Drops returns recent drops kept in memory, newest first.

func (*Stats) DropsFromLogs

func (s *Stats) DropsFromLogs(ctx context.Context, f DropFilter, since time.Duration, limit int) ([]Drop, error)

DropsFromLogs reads the drop log from VictoriaLogs (history beyond the controller's memory), newest first.

func (*Stats) Name

func (s *Stats) Name(ip string) string

Name returns what an address belongs to ("" when unknown).

func (*Stats) NodeCounters

func (s *Stats) NodeCounters(node string) map[string]firewall.Counts

NodeCounters returns one node's counters.

func (*Stats) OnHeartbeat

func (s *Stats) OnHeartbeat(node store.Node, hb *agentv1.Heartbeat)

OnHeartbeat records a node's counters and drops.

func (*Stats) SecurityErrors

func (s *Stats) SecurityErrors() map[string]string

SecurityErrors lists nodes that cannot enforce security groups.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL