servicetracker

package
v0.0.0-...-bdd2d77 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SecondsBetweenLookups = 10
)

Variables

View Source
var (
	Timeout = time.Duration(60 * time.Second)
)

Functions

This section is empty.

Types

type Host

type Host struct {
	Addr       netip.Addr
	Status     HostStatus
	LastActive time.Time
}

func MakeHost

func MakeHost(addr netip.Addr) *Host

func (*Host) IsActive

func (h *Host) IsActive() bool

func (*Host) IsRemoved

func (h *Host) IsRemoved() bool

func (*Host) SetActive

func (h *Host) SetActive() bool

SetActive sets the Host status to active. Returns true on status changes.

func (*Host) SetRemoved

func (h *Host) SetRemoved()

type HostStatus

type HostStatus int
const (
	Active HostStatus = iota
	Removed
)

type Tracker

type Tracker struct {
	LastUpdate time.Time
	// contains filtered or unexported fields
}

func MakeTracker

func MakeTracker(hostname string) *Tracker

func (*Tracker) ActiveHosts

func (t *Tracker) ActiveHosts() []*Host

ActiveHosts returns the list of active hosts in sorted order.

func (*Tracker) AddHost

func (t *Tracker) AddHost(addr netip.Addr)

func (*Tracker) RemoveHost

func (t *Tracker) RemoveHost(host *Host)

func (*Tracker) RemovedHosts

func (t *Tracker) RemovedHosts() []*Host

func (*Tracker) UpdateHost

func (t *Tracker) UpdateHost(host *Host)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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