storage

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 1, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

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

Database handles SQLite storage

func NewDatabase

func NewDatabase(dbPath string) (*Database, error)

NewDatabase creates a new SQLite database connection

func (*Database) CleanupOldData

func (d *Database) CleanupOldData(retentionDays int) error

CleanupOldData removes data older than the specified retention period

func (*Database) Close

func (d *Database) Close() error

Close closes the database connection

func (*Database) GetLatestSNMPResult

func (d *Database) GetLatestSNMPResult(host string) (*SNMPResult, error)

GetLatestSNMPResult retrieves the latest SNMP result for a specific host

func (*Database) GetOpenPortsForHost

func (d *Database) GetOpenPortsForHost(host string) ([]int, error)

GetOpenPortsForHost retrieves all open ports found for a specific host

func (*Database) GetSNMPDevices

func (d *Database) GetSNMPDevices() ([]string, error)

GetSNMPDevices retrieves a list of all SNMP devices from the database

func (*Database) GetTopTalkers

func (d *Database) GetTopTalkers(n int) (map[string]int64, error)

GetTopTalkers retrieves the top n hosts by traffic volume

func (*Database) GetTraceResults

func (d *Database) GetTraceResults(target string) ([]TraceResult, error)

GetTraceResults retrieves traceroute results for a specific target

func (*Database) SaveSNMPResult

func (d *Database) SaveSNMPResult(result interface{}) error

SaveSNMPResult saves SNMP polling results to the database

func (*Database) SaveScanResults

func (d *Database) SaveScanResults(results []interface{}) error

SaveScanResults saves port scan results to the database

func (*Database) SaveTraceResults

func (d *Database) SaveTraceResults(target string, results []interface{}) error

SaveTraceResults saves traceroute results to the database

func (*Database) SaveTrafficStats

func (d *Database) SaveTrafficStats(stats map[string]int64) error

SaveTrafficStats saves traffic statistics to the database

type InterfaceInfo

type InterfaceInfo struct {
	Index       int
	Name        string
	Description string
	Type        string
	Speed       uint64
	AdminStatus int
	OperStatus  int
	InOctets    uint64
	OutOctets   uint64
}

InterfaceInfo contains information about a network interface

type SNMPResult

type SNMPResult struct {
	Host        string
	SysName     string
	SysDescr    string
	SysUpTime   string
	SysContact  string
	SysLocation string
	Interfaces  []InterfaceInfo
	Timestamp   time.Time
}

SNMPResult represents SNMP data stored in the database

type ScanResult

type ScanResult struct {
	Host      string
	Port      int
	Open      bool
	Latency   time.Duration
	Timestamp time.Time
}

ScanResult represents a port scan result stored in the database

type TraceResult

type TraceResult struct {
	Target   string
	Hop      int
	Address  string
	Hostname string
	Latency  time.Duration
	Time     time.Time
}

TraceResult represents a traceroute hop result stored in the database

Jump to

Keyboard shortcuts

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