clients

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package clients covers the clients on the network: the mesh's current and historic client lists, Wi-Fi association details and signal quality, client counts, custom client settings (name, pause), fingerprints and the guest Wi-Fi whitelist.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Fingerprints

func Fingerprints(ctx context.Context, c *amplifi.Client) (map[string]map[string]any, error)

Fingerprints returns the router's identification of each client (ClusterNode.fingerprint GetFingerprint), keyed by MAC as the router sends it.

func GuestWhitelist

func GuestWhitelist(ctx context.Context, c *amplifi.Client) ([]any, error)

GuestWhitelist returns the guest Wi-Fi whitelist (ClusterNode.GetGuestWifiWhitelist) as the router sends it.

func Rename

func Rename(ctx context.Context, c *amplifi.Client, mac amplifi.MAC, name string) error

Rename sets the name shown for a client. The router reports that name as "description" in GetClientInfo, so this sends {"description": name} through SetClientCustomInfo. This is untested.

func SetPaused

func SetPaused(ctx context.Context, c *amplifi.Client, mac amplifi.MAC, paused bool) error

SetPaused blocks (paused true) or restores a client's internet access (ClusterNode.SetWanClientPause).

Types

type Association

type Association struct {
	MAC            amplifi.MAC `json:"mac"`
	Unit           amplifi.MAC `json:"unit,omitempty"`
	Band           string      `json:"band"`
	Network        string      `json:"network"`
	Mode           string      `json:"mode,omitempty"`
	RadioMode      string      `json:"radio_mode,omitempty"`
	Signal         int         `json:"signal"`
	Inactive       int         `json:"inactive"`
	RxBytes        int64       `json:"rx_bytes"`
	TxBytes        int64       `json:"tx_bytes"`
	RxBitrate      int         `json:"rx_bitrate"`
	TxBitrate      int         `json:"tx_bitrate"`
	RxMCS          int         `json:"rx_mcs"`
	TxMCS          int         `json:"tx_mcs"`
	RxMHz          int         `json:"rx_mhz"`
	TxMHz          int         `json:"tx_mhz"`
	SpatialStreams int         `json:"spatial_streams"`
	MaxBandwidth   int         `json:"max_bandwidth"`
	Happiness      int         `json:"happiness"`
	IP             netip.Addr  `json:"ip,omitzero"`
	LeaseValidity  int         `json:"lease_validity"`
	HostName       string      `json:"host_name,omitempty"`
	Description    string      `json:"description,omitempty"`
}

Association is one client's Wi-Fi association as reported by GetWifiClientInfo. Signal is the router's signal quality figure; its scale is unknown. RxBitrate, TxBitrate, Inactive and LeaseValidity are the router's raw values and their units are unconfirmed; bitrates such as 866700 for an 866.7 Mbit/s link suggest kbit/s.

func Associations

func Associations(ctx context.Context, c *amplifi.Client) ([]Association, error)

Associations lists the Wi-Fi associations on every network and band. It asks ClusterNode.GetWifiClientInfo, which covers the whole mesh and names each client's unit, and falls back to Device.GetWifiClientInfo (this unit only) if the unit refuses.

type Client

type Client struct {
	MAC amplifi.MAC `json:"mac"`

	// Name is Description, else HostName, else the MAC.
	Name string `json:"name"`

	// Description is the name set by the user.
	Description string     `json:"description,omitempty"`
	HostName    string     `json:"host_name,omitempty"`
	IP          netip.Addr `json:"ip,omitzero"`

	// Connection is "wired", "2.4GHz", "5GHz", "wifi" or the router's value.
	Connection string `json:"connection,omitempty"`

	// Port is the Ethernet port of a wired client.
	Port *int `json:"port,omitempty"`

	// Network is the Wi-Fi network: main, guest, iot, ...
	Network string `json:"network,omitempty"`

	// Unit is the mesh point the client is attached to; nil for the router.
	Unit     amplifi.MAC `json:"unit,omitempty"`
	UnitName string      `json:"unit_name,omitempty"`

	// IconID is the fingerprint device ID.
	IconID int  `json:"icon_id,omitempty"`
	Online bool `json:"online"`

	// LastSeen and TimesSeen are only set in History.
	LastSeen  time.Time `json:"last_seen,omitzero"`
	TimesSeen int       `json:"times_seen,omitempty"`

	WiFi   *Association   `json:"wifi,omitempty"`
	Custom map[string]any `json:"custom,omitempty"`
	Fields map[string]any `json:"fields,omitempty"`
}

Client is a Wi-Fi or wired client, merged from the mesh's client list (ClusterNode.GetClientInfo) and the Wi-Fi association tables. Fields holds the client list entry as the router sent it.

func History

func History(ctx context.Context, c *amplifi.Client) ([]Client, error)

History lists clients the mesh has seen before (ClusterNode.GetHistoricClientInfo), sorted by name, then MAC. Clients in the current client list are marked online. History entries do not say which unit a client used, so Unit and UnitName stay empty.

func List

func List(ctx context.Context, c *amplifi.Client) ([]Client, error)

List lists the clients known to the mesh (ClusterNode.GetClientInfo), enriched with custom info, Wi-Fi details and unit names when the router provides them. Wi-Fi clients missing from the client list are included. The result is sorted by name, then MAC.

type Counts

type Counts struct {
	ByBand    map[string]int `json:"by_band"`
	ByNetwork map[string]int `json:"by_network"`
	Total     int            `json:"total"`
}

Counts is the number of Wi-Fi clients by band and by network.

func Count

func Count(ctx context.Context, c *amplifi.Client) (*Counts, error)

Count counts the Wi-Fi clients connected to the unit, leaving out mesh backhaul and setup networks.

type Signal

type Signal struct {
	MAC      amplifi.MAC `json:"mac"`
	Unit     amplifi.MAC `json:"unit,omitempty"`
	Band     string      `json:"band"`
	Network  string      `json:"network"`
	UnitName string      `json:"unit_name,omitempty"`
	Quality  int         `json:"quality"`
}

Signal is one Wi-Fi client's signal quality.

func Signals

func Signals(ctx context.Context, c *amplifi.Client) ([]Signal, error)

Signals reports the signal quality of every Wi-Fi client. It asks ClusterNode.GetWifiClientSignalQuality and falls back to the Device variant (this unit only) if the unit refuses.

Jump to

Keyboard shortcuts

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