Documentation ¶
Overview ¶
Package unifi implements a client for the Ubiquiti UniFi Controller v4 and v5 API.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InsecureHTTPClient ¶
InsecureHTTPClient creates a *http.Client which does not verify a UniFi Controller's certificate chain and hostname.
Please think carefully before using this client: it should only be used with self-hosted, internal UniFi Controllers.
Types ¶
type Alarm ¶
type Alarm struct { ID string APMAC net.HardwareAddr APName string Archived bool DateTime time.Time Key string Message string SiteID string Subsystem string }
An Alarm is an alert which is triggered when a Device becomes unavailable.
func (*Alarm) UnmarshalJSON ¶
UnmarshalJSON unmarshals the raw JSON representation of an Alarm.
type Client ¶
type Client struct { UserAgent string // contains filtered or unexported fields }
A Client is a client for the Ubiquiti UniFi Controller v4 API.
Client.Login must be called and return a nil error before any additional actions can be performed with a Client.
func NewClient ¶
NewClient creates a new Client, using the input API address and an optional HTTP client. If no HTTP client is specified, a default one will be used.
If working with a self-hosted UniFi Controller which does not have a valid TLS certificate, InsecureHTTPClient can be used.
Client.Login must be called and return a nil error before any additional actions can be performed with a Client.
func (*Client) Login ¶
Login authenticates against the UniFi Controller using the specified username and password. Login must be called and return a nil error before any additional actions can be performed.
type Device ¶
type Device struct { ID string Adopted bool InformIP net.IP InformURL *url.URL Model string Name string NICs []*NIC Radios []*Radio Serial string SiteID string Stats *DeviceStats Uptime time.Duration Version string }
A Device is a Ubiquiti UniFi device, such as a UniFi access point.
func (*Device) UnmarshalJSON ¶
UnmarshalJSON unmarshals the raw JSON representation of a Device.
type DeviceStats ¶
type DeviceStats struct { TotalBytes float64 All *WirelessStats Guest *WirelessStats User *WirelessStats Uplink *WiredStats }
DeviceStats contains device network activity statistics.
func (*DeviceStats) String ¶
func (s *DeviceStats) String() string
type NIC ¶
type NIC struct { MAC net.HardwareAddr Name string }
A NIC is a wired ethernet network interface, attached to a Device.
type Radio ¶
type Radio struct { BuiltInAntenna bool BuiltInAntennaGain int MaxTXPower int MinTXPower int Name string Radio string Stats *RadioStationsStats }
A Radio is a wireless radio, attached to a Device.
type RadioStationsStats ¶
type RadioStationsStats struct { NumberStations int NumberGuestStations int NumberUserStations int }
RadioStationsStats contains Station statistics for a Radio.
type Site ¶
type Site struct { ID string `json:"_id"` Description string `json:"desc"` Name string `json:"name"` NumAPs int `json:"num_ap"` NumStations int `json:"num_sta"` Role string `json:"role"` }
A Site is a physical location with UniFi devices managed by a UniFi Controller.
type Station ¶
type Station struct { ID string APMAC net.HardwareAddr AssociationTime time.Time Channel int FirstSeen time.Time Hostname string // Device-provided name IdleTime time.Duration IP net.IP IsWired bool LastSeen time.Time MAC net.HardwareAddr RoamCount int Name string // Unifi-set name Noise int RSSI int SiteID string Stats *StationStats Uptime time.Duration UserID string }
A Station is a client connected to a UniFi access point.
func (*Station) UnmarshalJSON ¶
UnmarshalJSON unmarshals the raw JSON representation of a Station.
type StationStats ¶
type StationStats struct { ReceiveBytes int64 ReceivePackets int64 ReceiveRate int TransmitBytes int64 TransmitPackets int64 TransmitPower int TransmitRate int }
StationStats contains station network activity statistics.
type WiredStats ¶
type WiredStats struct { ReceiveBytes float64 ReceivePackets float64 TransmitBytes float64 TransmitPackets float64 }
WiredStats contains wired device network activity statistics.
func (*WiredStats) String ¶
func (s *WiredStats) String() string
type WirelessStats ¶
type WirelessStats struct { ReceiveBytes float64 ReceivePackets float64 TransmitBytes float64 TransmitDropped float64 TransmitPackets float64 }
WirelessStats contains wireless device network activity statistics.
func (*WirelessStats) String ¶
func (s *WirelessStats) String() string