capture

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultInterface

func DefaultInterface() (string, error)

func ListInterfaces

func ListInterfaces() ([]string, error)

Types

type Capture

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

func New

func New(iface string, threshold int) (*Capture, error)

func (*Capture) Interface

func (c *Capture) Interface() string

func (*Capture) Start

func (c *Capture) Start()

func (*Capture) Stop

func (c *Capture) Stop()

func (*Capture) Ticker

func (c *Capture) Ticker() <-chan Snapshot

func (*Capture) Uptime

func (c *Capture) Uptime() time.Duration

type DemoCapture

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

DemoCapture generates realistic simulated traffic data for demos and screenshots.

func NewDemo

func NewDemo(threshold int) *DemoCapture

func (*DemoCapture) Interface

func (d *DemoCapture) Interface() string

func (*DemoCapture) Start

func (d *DemoCapture) Start()

func (*DemoCapture) Stop

func (d *DemoCapture) Stop()

func (*DemoCapture) Ticker

func (d *DemoCapture) Ticker() <-chan Snapshot

func (*DemoCapture) Uptime

func (d *DemoCapture) Uptime() time.Duration

type IPCount

type IPCount struct {
	IP    string `json:"ip"`
	Count uint64 `json:"count"`
}

type PortCount

type PortCount struct {
	Port     uint16  `json:"port"`
	Protocol string  `json:"protocol"`
	Count    uint64  `json:"count"`
	Percent  float64 `json:"percent"`
}

type Snapshot

type Snapshot struct {
	Timestamp  time.Time   `json:"timestamp"`
	Interface  string      `json:"interface"`
	PPS        uint64      `json:"pps"`
	BPS        uint64      `json:"bps"`
	PeakPPS    uint64      `json:"peak_pps"`
	PeakBPS    uint64      `json:"peak_bps"`
	TCP        float64     `json:"tcp_pct"`
	UDP        float64     `json:"udp_pct"`
	ICMP       float64     `json:"icmp_pct"`
	Other      float64     `json:"other_pct"`
	UniqueIPs  int         `json:"unique_src_ips"`
	TopSources []IPCount   `json:"top_sources"`
	TopPorts   []PortCount `json:"top_ports"`
	AvgPktSize int         `json:"avg_pkt_size"`
	Severity   string      `json:"severity"`
	AttackType string      `json:"attack_type,omitempty"`
	History    []uint64    `json:"-"`
}

func (*Snapshot) JSON

func (s *Snapshot) JSON() string

type Source

type Source interface {
	Start()
	Stop()
	Ticker() <-chan Snapshot
	Interface() string
	Uptime() time.Duration
}

Source is the interface that both live capture and demo mode implement.

Jump to

Keyboard shortcuts

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