Documentation
¶
Overview ¶
Package mesh covers the units that make up the mesh: the connected mesh points, every registered unit, backhaul signal quality, the Ethernet ports of every unit, factory pairing of new mesh points, and ignoring or factory resetting units.
Index ¶
- func AcceptPairing(ctx context.Context, c *amplifi.Client, peerID string) error
- func FactoryReset(ctx context.Context, c *amplifi.Client, mac amplifi.MAC) error
- func Ignore(ctx context.Context, c *amplifi.Client, macs ...amplifi.MAC) error
- func RejectPairing(ctx context.Context, c *amplifi.Client, peerID string) error
- func ResettableUnits(ctx context.Context, c *amplifi.Client) ([]amplifi.MAC, error)
- type Pairing
- type Peer
- type Port
- type Signal
- type Unit
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AcceptPairing ¶
AcceptPairing accepts factory pairing with peerID.
func FactoryReset ¶
FactoryReset factory resets one mesh point (not the unit this session is connected to). It is irreversible.
func Ignore ¶
Ignore tells the router to ignore the given units, so they are no longer offered for adoption into the mesh. The argument, a msgpack array of binary MACs as for FactoryReset, is untested.
func RejectPairing ¶
RejectPairing rejects factory pairing with peerID.
Types ¶
type Pairing ¶
type Pairing struct {
PeerID string `json:"peer_id"`
MAC amplifi.MAC `json:"mac"`
Name string `json:"name"`
State string `json:"state"`
}
Pairing is a unit waiting to be paired with, or paired to, the router at the factory pairing step. PeerID is the router's key for it, which AcceptPairing and RejectPairing take. It is normally the unit's MAC, and MAC holds it parsed when it is one.
type Peer ¶
type Peer struct {
MAC amplifi.MAC `json:"mac"`
Name string `json:"name"`
Role amplifi.Role `json:"role"`
IP netip.Addr `json:"ip"`
// Uptime marshals as whole seconds.
Uptime time.Duration `json:"uptime"`
// Band and RSSI (dBm) describe the backhaul link.
Band string `json:"band"`
RSSI int `json:"rssi"`
Master amplifi.MAC `json:"master,omitempty"`
}
Peer is a mesh point as seen by the router.
func Peers ¶
Peers lists the mesh points connected to the router (the router itself is not included), the router role first and the rest by name.
func (Peer) MarshalJSON ¶
MarshalJSON renders the uptime in seconds.
type Port ¶
type Port struct {
Unit amplifi.MAC `json:"unit"`
Port string `json:"port"`
Link bool `json:"link"`
LinkSpeedMbps int `json:"link_speed_mbps"`
RxKbps int `json:"rx_kbps"`
TxKbps int `json:"tx_kbps"`
}
Port is the state of one Ethernet port on one unit.
func Ports ¶
Ports reports the Ethernet ports of every unit in the mesh, sorted by unit and port.
GetEthernetPortInfo only has data while the router's port polling is on; otherwise it is empty. The router's EthernetPortInfoChanged signal carries the same data, so Ports then waits briefly for one. If none arrives the result is empty and the session is unusable afterwards.
type Signal ¶
type Signal struct {
Band string `json:"band"`
Network string `json:"network"`
MAC amplifi.MAC `json:"mac"`
Quality int `json:"quality"`
}
Signal is the backhaul signal quality of one mesh peer as seen on one band and network.