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 ¶
- func Fingerprints(ctx context.Context, c *amplifi.Client) (map[string]map[string]any, error)
- func GuestWhitelist(ctx context.Context, c *amplifi.Client) ([]any, error)
- func Rename(ctx context.Context, c *amplifi.Client, mac amplifi.MAC, name string) error
- func SetPaused(ctx context.Context, c *amplifi.Client, mac amplifi.MAC, paused bool) error
- type Association
- type Client
- type Counts
- type Signal
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Fingerprints ¶
Fingerprints returns the router's identification of each client (ClusterNode.fingerprint GetFingerprint), keyed by MAC as the router sends it.
func GuestWhitelist ¶
GuestWhitelist returns the guest Wi-Fi whitelist (ClusterNode.GetGuestWifiWhitelist) as the router sends it.
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 ¶
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 ¶
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.
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.