mesh

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 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

Constants

This section is empty.

Variables

This section is empty.

Functions

func AcceptPairing

func AcceptPairing(ctx context.Context, c *amplifi.Client, peerID string) error

AcceptPairing accepts factory pairing with peerID.

func FactoryReset

func FactoryReset(ctx context.Context, c *amplifi.Client, mac amplifi.MAC) error

FactoryReset factory resets one mesh point (not the unit this session is connected to). It is irreversible.

func Ignore

func Ignore(ctx context.Context, c *amplifi.Client, macs ...amplifi.MAC) error

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

func RejectPairing(ctx context.Context, c *amplifi.Client, peerID string) error

RejectPairing rejects factory pairing with peerID.

func ResettableUnits

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

ResettableUnits lists the units the router is able to factory reset. The result format is unknown; binary MACs found as array elements or map keys are returned.

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.

func Pairings

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

Pairings returns the factory pairing state, ordered by peer ID.

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

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

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

func (p Peer) MarshalJSON() ([]byte, error)

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

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

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.

func Signals

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

Signals reports the signal quality of the mesh peers' wireless links, sorted by band, network and MAC. Not every firmware supports it.

type Unit

type Unit struct {
	MAC      amplifi.MAC  `json:"mac"`
	Name     string       `json:"name"`
	Role     amplifi.Role `json:"role"`
	Platform string       `json:"platform,omitempty"`
}

Unit is a unit registered in the mesh, whether or not it is currently connected.

func Units

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

Units lists every unit registered in the mesh, the router first and the rest by name.

Jump to

Keyboard shortcuts

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