model

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2025 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package model provides data types used throughout the application.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Device

type Device struct {
	ID       int64
	NetID    int64
	Name     string
	OS       string
	Addr     []net.Addr
	BigHead  bool
	LastSeen time.Time
}

Device is a computer - in the most inclusive sense of the word - that is connected to an IP network. It has zero or more IP addresses, a name, and is considered a BigHead if it is a *REAL* computer, which by my definition is one you can do some coding on (i.e. smartphones, tablets, smart TVs, etc. are NOT BigHeads).

func (*Device) AddrStr

func (d *Device) AddrStr() string

AddrStr returns a string representation of the receiver's addresses that is also valid JSON.

func (*Device) DefaultAddr

func (d *Device) DefaultAddr() string

DefaultAddr returns the first IP address, stringified.

func (*Device) IsLive

func (d *Device) IsLive() bool

IsLive returns true if the last interaction with the device was within the period configured as LiveTimeout.

type DiskFree added in v0.2.0

type DiskFree struct {
	ID          int64
	DevID       int64
	Timestamp   time.Time
	PercentFree int64
}

DiskFree captures the percentage of free disk space on the root filesystem of a Device.

type Network

type Network struct {
	ID          int64
	Addr        *net.IPNet
	Description string
	LastScan    time.Time
}

Network represents a range of IP addresses where Devices may reside.

func NewNetwork

func NewNetwork(addr, desc string) (*Network, error)

NewNetwork creates a fresh Network with the given address and description.

func (*Network) Enumerate

func (n *Network) Enumerate(q chan<- net.IP) error

Enumerate generates all IP addresses for the Network and sends them through the channel passed in as its argument.

type Updates

type Updates struct {
	ID               int64
	DevID            int64
	Timestamp        time.Time
	AvailableUpdates []string
}

Updates is a set of available Updates on a given Device at a certain point in time.

func (*Updates) UpdatesPending

func (up *Updates) UpdatesPending() bool

UpdatesPending returns true if the list of AvailableUpdates contains at least one element.

type Uptime

type Uptime struct {
	ID        int64
	DevID     int64
	Timestamp time.Time
	Uptime    time.Duration
	Load      [3]float64
}

Uptime captures the time a Device has been running since last reboot/power-on as well as the current system load average.

Directories

Path Synopsis
Package info provides symbolic constants to identify the types of information queried on remote Devices.
Package info provides symbolic constants to identify the types of information queried on remote Devices.

Jump to

Keyboard shortcuts

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