Documentation ¶
Overview ¶
Package unifi provides a set of types to unload (unmarshal) Unifi Ubiquiti controller data. Also provided are methods to easily get data for devices - things like access points and switches, and for clients - the things connected to those access points and switches. As a bonus, each device and client type provided has an attached method to create InfluxDB datapoints.
Index ¶
- Constants
- type Clients
- type Devices
- type FlexBool
- type FlexInt
- type Logger
- type Site
- type UAP
- type UCL
- type USG
- type USW
- type Unifi
- func (u *Unifi) GetClients(sites []Site) (*Clients, error)
- func (u *Unifi) GetData(methodPath string, v interface{}) error
- func (u *Unifi) GetDevices(sites []Site) (*Devices, error)
- func (u *Unifi) GetSites() ([]Site, error)
- func (u *Unifi) UniReq(apiPath string, params string) (req *http.Request, err error)
Constants ¶
const ( // SiteList is the path to the api site list. SiteList string = "/api/self/sites" // ClientPath is Unifi Clients API Path ClientPath string = "/api/s/%s/stat/sta" // DevicePath is where we get data about Unifi devices. DevicePath string = "/api/s/%s/stat/device" // NetworkPath contains network-configuration data. Not really graphable. NetworkPath string = "/api/s/%s/rest/networkconf" // UserGroupPath contains usergroup configurations. UserGroupPath string = "/api/s/%s/rest/usergroup" // LoginPath is Unifi Controller Login API Path LoginPath string = "/api/login" )
This is a list of unifi API paths. The %s in each string must be replaced with a Site.Name.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Clients ¶
type Clients struct {
UCLs []UCL
}
Clients contains a list that contains all of the unifi clients from a controller.
type Devices ¶
Devices contains a list of all the unifi devices from a controller. Contains Access points, security gateways and switches.
type FlexBool ¶ added in v1.0.1
FlexBool provides a container and unmarshalling for fields that may be boolean or strings in the Unifi API.
func (*FlexBool) UnmarshalJSON ¶ added in v1.0.1
UnmarshalJSO method converts armed/disarmed, yes/no, active/inactive or 0/1 to true/false. Really it converts ready, up, t, armed, yes, active, enabled, 1, true to true. Anything else is false.
type FlexInt ¶
FlexInt provides a container and unmarshalling for fields that may be numbers or strings in the Unifi API.
func (*FlexInt) UnmarshalJSON ¶
UnmarshalJSON converts a string or number to an integer. Generally, do call this directly, it's used in the json interface.
type Logger ¶
type Logger func(msg string, fmt ...interface{})
Logger is a base type to deal with changing log outputs. Create a logger that matches this interface to capture debug and error logs.
type Site ¶
Site represents a site's data. There are more pieces to this, but this is all we expose.
type UAP ¶
type UAP struct { /* This was auto generated and then slowly edited by hand to get all the data types right and graphable. No ones feelings will be hurt if you want to break this up into multiple structs, and/or make it better in general. */ ID string `json:"_id"` UUptime float64 `json:"_uptime"` AdoptIP string `json:"adopt_ip,omitempty"` AdoptURL string `json:"adopt_url,omitempty"` Adopted FlexBool `json:"adopted"` AntennaTable []struct { ID float64 `json:"id"` Name string `json:"name"` Wifi0Gain float64 `json:"wifi0_gain"` Wifi1Gain float64 `json:"wifi1_gain"` } `json:"antenna_table"` BandsteeringMode string `json:"bandsteering_mode,omitempty"` BoardRev int `json:"board_rev"` Bytes float64 `json:"bytes"` BytesD float64 `json:"bytes-d"` BytesR float64 `json:"bytes-r"` Cfgversion string `json:"cfgversion"` ConfigNetwork struct { IP string `json:"ip"` Type string `json:"type"` } `json:"config_network"` ConnectRequestIP string `json:"connect_request_ip"` ConnectRequestPort string `json:"connect_request_port"` ConsideredLostAt float64 `json:"considered_lost_at"` CountrycodeTable []float64 `json:"countrycode_table"` Default FlexBool `json:"default,omitempty"` DeviceID string `json:"device_id"` DiscoveredVia string `json:"discovered_via,omitempty"` DownlinkTable []interface{} `json:"downlink_table"` EthernetTable []struct { Mac string `json:"mac"` Name string `json:"name"` NumPort float64 `json:"num_port"` } `json:"ethernet_table"` FwCaps int `json:"fw_caps"` GuestNumSta int `json:"guest-num_sta"` GuestToken string `json:"guest_token"` HasEth1 FlexBool `json:"has_eth1"` HasSpeaker FlexBool `json:"has_speaker"` InformIP string `json:"inform_ip"` InformURL string `json:"inform_url"` IP string `json:"ip"` Isolated FlexBool `json:"isolated"` KnownCfgversion string `json:"known_cfgversion"` LastSeen float64 `json:"last_seen"` LastUplink struct { UplinkMac string `json:"uplink_mac"` UplinkRemotePort int `json:"uplink_remote_port"` } `json:"last_uplink"` LedOverride string `json:"led_override"` Locating FlexBool `json:"locating"` Mac string `json:"mac"` Model string `json:"model"` Name string `json:"name"` NextHeartbeatAt float64 `json:"next_heartbeat_at"` NumSta float64 `json:"num_sta"` OutdoorModeOverride string `json:"outdoor_mode_override"` PortTable []struct { AggregatedBy FlexBool `json:"aggregated_by"` AttrNoEdit FlexBool `json:"attr_no_edit,omitempty"` Autoneg FlexBool `json:"autoneg"` BytesR float64 `json:"bytes-r"` Enable FlexBool `json:"enable"` FlowctrlRx FlexBool `json:"flowctrl_rx"` FlowctrlTx FlexBool `json:"flowctrl_tx"` FullDuplex FlexBool `json:"full_duplex"` IsUplink FlexBool `json:"is_uplink"` Jumbo FlexBool `json:"jumbo"` MacTable []struct { Age float64 `json:"age"` Mac string `json:"mac"` Static FlexBool `json:"static"` Uptime float64 `json:"uptime"` Vlan float64 `json:"vlan"` } `json:"mac_table"` Masked FlexBool `json:"masked"` Media string `json:"media"` Name string `json:"name"` OpMode string `json:"op_mode"` PoeCaps float64 `json:"poe_caps"` PortDelta struct { RxBytes float64 `json:"rx_bytes"` RxPackets float64 `json:"rx_packets"` TimeDelta float64 `json:"time_delta"` TxBytes float64 `json:"tx_bytes"` TxPackets float64 `json:"tx_packets"` } `json:"port_delta"` PortIdx float64 `json:"port_idx"` PortPoe FlexBool `json:"port_poe"` PortconfID string `json:"portconf_id"` RxBroadcast float64 `json:"rx_broadcast"` RxBytes float64 `json:"rx_bytes"` RxBytesR float64 `json:"rx_bytes-r"` RxDropped float64 `json:"rx_dropped"` RxErrors float64 `json:"rx_errors"` RxMulticast float64 `json:"rx_multicast"` RxPackets float64 `json:"rx_packets"` Speed float64 `json:"speed"` StpPathcost float64 `json:"stp_pathcost"` StpState string `json:"stp_state"` TxBroadcast float64 `json:"tx_broadcast"` TxBytes float64 `json:"tx_bytes"` TxBytesR float64 `json:"tx_bytes-r"` TxDropped float64 `json:"tx_dropped"` TxErrors float64 `json:"tx_errors"` TxMulticast float64 `json:"tx_multicast"` TxPackets float64 `json:"tx_packets"` Up FlexBool `json:"up"` } `json:"port_table"` RadioTable []struct { BuiltinAntGain float64 `json:"builtin_ant_gain"` BuiltinAntenna FlexBool `json:"builtin_antenna"` Channel FlexInt `json:"channel"` CurrentAntennaGain float64 `json:"current_antenna_gain"` Ht string `json:"ht"` MaxTxpower float64 `json:"max_txpower"` MinRssiEnabled FlexBool `json:"min_rssi_enabled"` MinTxpower float64 `json:"min_txpower"` Name string `json:"name"` Nss float64 `json:"nss"` Radio string `json:"radio"` RadioCaps float64 `json:"radio_caps"` TxPower FlexInt `json:"tx_power"` TxPowerMode string `json:"tx_power_mode"` WlangroupID string `json:"wlangroup_id"` HasDfs FlexBool `json:"has_dfs,omitempty"` HasFccdfs FlexBool `json:"has_fccdfs,omitempty"` Is11Ac FlexBool `json:"is_11ac,omitempty"` } `json:"radio_table"` RadioTableStats []struct { AstBeXmit float64 `json:"ast_be_xmit"` AstCst float64 `json:"ast_cst"` AstTxto float64 `json:"ast_txto"` Channel float64 `json:"channel"` CuSelfRx float64 `json:"cu_self_rx"` CuSelfTx float64 `json:"cu_self_tx"` CuTotal float64 `json:"cu_total"` Extchannel float64 `json:"extchannel"` Gain float64 `json:"gain"` GuestNumSta float64 `json:"guest-num_sta"` Name string `json:"name"` NumSta float64 `json:"num_sta"` Radio string `json:"radio"` State string `json:"state"` TxPackets float64 `json:"tx_packets"` TxPower FlexInt `json:"tx_power"` TxRetries float64 `json:"tx_retries"` UserNumSta float64 `json:"user-num_sta"` } `json:"radio_table_stats"` Rollupgrade FlexBool `json:"rollupgrade"` RxBytes float64 `json:"rx_bytes"` RxBytesD float64 `json:"rx_bytes-d"` ScanRadioTable []interface{} `json:"scan_radio_table"` Scanning FlexBool `json:"scanning"` Serial string `json:"serial"` SiteID string `json:"site_id"` SiteName string `json:"-"` SpectrumScanning FlexBool `json:"spectrum_scanning"` SSHSessionTable []interface{} `json:"ssh_session_table"` Stat struct { Ap string `json:"ap"` Bytes float64 `json:"bytes"` Datetime string `json:"datetime"` Duration float64 `json:"duration"` GuestRxBytes float64 `json:"guest-rx_bytes"` GuestRxCrypts float64 `json:"guest-rx_crypts"` GuestRxDropped float64 `json:"guest-rx_dropped"` GuestRxErrors float64 `json:"guest-rx_errors"` GuestRxFrags float64 `json:"guest-rx_frags"` GuestRxPackets float64 `json:"guest-rx_packets"` GuestTxBytes float64 `json:"guest-tx_bytes"` GuestTxDropped float64 `json:"guest-tx_dropped"` GuestTxErrors float64 `json:"guest-tx_errors"` GuestTxPackets float64 `json:"guest-tx_packets"` GuestTxRetries float64 `json:"guest-tx_retries"` O string `json:"o"` Oid string `json:"oid"` Port1RxBroadcast float64 `json:"port_1-rx_broadcast"` Port1RxBytes float64 `json:"port_1-rx_bytes"` Port1RxMulticast float64 `json:"port_1-rx_multicast"` Port1RxPackets float64 `json:"port_1-rx_packets"` Port1TxBroadcast float64 `json:"port_1-tx_broadcast"` Port1TxBytes float64 `json:"port_1-tx_bytes"` Port1TxMulticast float64 `json:"port_1-tx_multicast"` Port1TxPackets float64 `json:"port_1-tx_packets"` RxBytes float64 `json:"rx_bytes"` RxCrypts float64 `json:"rx_crypts"` RxDropped float64 `json:"rx_dropped"` RxErrors float64 `json:"rx_errors"` RxFrags float64 `json:"rx_frags"` RxPackets float64 `json:"rx_packets"` SiteID string `json:"site_id"` Time float64 `json:"time"` TxBytes float64 `json:"tx_bytes"` TxDropped float64 `json:"tx_dropped"` TxErrors float64 `json:"tx_errors"` TxPackets float64 `json:"tx_packets"` TxRetries float64 `json:"tx_retries"` UserRxBytes float64 `json:"user-rx_bytes"` UserRxCrypts float64 `json:"user-rx_crypts"` UserRxDropped float64 `json:"user-rx_dropped"` UserRxErrors float64 `json:"user-rx_errors"` UserRxFrags float64 `json:"user-rx_frags"` UserRxPackets float64 `json:"user-rx_packets"` UserTxBytes float64 `json:"user-tx_bytes"` UserTxDropped float64 `json:"user-tx_dropped"` UserTxErrors float64 `json:"user-tx_errors"` UserTxPackets float64 `json:"user-tx_packets"` UserTxRetries float64 `json:"user-tx_retries"` UserWifi0RxBytes float64 `json:"user-wifi0-rx_bytes"` UserWifi0RxCrypts float64 `json:"user-wifi0-rx_crypts"` UserWifi0RxDropped float64 `json:"user-wifi0-rx_dropped"` UserWifi0RxErrors float64 `json:"user-wifi0-rx_errors"` UserWifi0RxFrags float64 `json:"user-wifi0-rx_frags"` UserWifi0RxPackets float64 `json:"user-wifi0-rx_packets"` UserWifi0TxBytes float64 `json:"user-wifi0-tx_bytes"` UserWifi0TxDropped float64 `json:"user-wifi0-tx_dropped"` UserWifi0TxErrors float64 `json:"user-wifi0-tx_errors"` UserWifi0TxPackets float64 `json:"user-wifi0-tx_packets"` UserWifi0TxRetries float64 `json:"user-wifi0-tx_retries"` UserWifi1RxBytes float64 `json:"user-wifi1-rx_bytes"` UserWifi1RxCrypts float64 `json:"user-wifi1-rx_crypts"` UserWifi1RxDropped float64 `json:"user-wifi1-rx_dropped"` UserWifi1RxErrors float64 `json:"user-wifi1-rx_errors"` UserWifi1RxFrags float64 `json:"user-wifi1-rx_frags"` UserWifi1RxPackets float64 `json:"user-wifi1-rx_packets"` UserWifi1TxBytes float64 `json:"user-wifi1-tx_bytes"` UserWifi1TxDropped float64 `json:"user-wifi1-tx_dropped"` UserWifi1TxErrors float64 `json:"user-wifi1-tx_errors"` UserWifi1TxPackets float64 `json:"user-wifi1-tx_packets"` UserWifi1TxRetries float64 `json:"user-wifi1-tx_retries"` Wifi0RxBytes float64 `json:"wifi0-rx_bytes"` Wifi0RxCrypts float64 `json:"wifi0-rx_crypts"` Wifi0RxDropped float64 `json:"wifi0-rx_dropped"` Wifi0RxErrors float64 `json:"wifi0-rx_errors"` Wifi0RxFrags float64 `json:"wifi0-rx_frags"` Wifi0RxPackets float64 `json:"wifi0-rx_packets"` Wifi0TxBytes float64 `json:"wifi0-tx_bytes"` Wifi0TxDropped float64 `json:"wifi0-tx_dropped"` Wifi0TxErrors float64 `json:"wifi0-tx_errors"` Wifi0TxPackets float64 `json:"wifi0-tx_packets"` Wifi0TxRetries float64 `json:"wifi0-tx_retries"` Wifi1RxBytes float64 `json:"wifi1-rx_bytes"` Wifi1RxCrypts float64 `json:"wifi1-rx_crypts"` Wifi1RxDropped float64 `json:"wifi1-rx_dropped"` Wifi1RxErrors float64 `json:"wifi1-rx_errors"` Wifi1RxFrags float64 `json:"wifi1-rx_frags"` Wifi1RxPackets float64 `json:"wifi1-rx_packets"` Wifi1TxBytes float64 `json:"wifi1-tx_bytes"` Wifi1TxDropped float64 `json:"wifi1-tx_dropped"` Wifi1TxErrors float64 `json:"wifi1-tx_errors"` Wifi1TxPackets float64 `json:"wifi1-tx_packets"` Wifi1TxRetries float64 `json:"wifi1-tx_retries"` } `json:"stat"` State int `json:"state"` SysStats struct { Loadavg1 float64 `json:"loadavg_1,string"` Loadavg15 float64 `json:"loadavg_15,string"` Loadavg5 float64 `json:"loadavg_5,string"` MemBuffer float64 `json:"mem_buffer"` MemTotal float64 `json:"mem_total"` MemUsed float64 `json:"mem_used"` } `json:"sys_stats"` SystemStats struct { CPU float64 `json:"cpu,string"` Mem float64 `json:"mem,string"` Uptime float64 `json:"uptime,string"` } `json:"system-stats"` TxBytes float64 `json:"tx_bytes"` TxBytesD float64 `json:"tx_bytes-d"` Type string `json:"type"` Upgradable FlexBool `json:"upgradable"` Uplink struct { FullDuplex FlexBool `json:"full_duplex"` IP string `json:"ip"` Mac string `json:"mac"` MaxSpeed int `json:"max_speed"` MaxVlan int `json:"max_vlan"` Media string `json:"media"` Name string `json:"name"` Netmask string `json:"netmask"` NumPort int `json:"num_port"` RxBytes float64 `json:"rx_bytes"` RxBytesR float64 `json:"rx_bytes-r"` RxDropped float64 `json:"rx_dropped"` RxErrors float64 `json:"rx_errors"` RxMulticast float64 `json:"rx_multicast"` RxPackets float64 `json:"rx_packets"` Speed float64 `json:"speed"` TxBytes float64 `json:"tx_bytes"` TxBytesR float64 `json:"tx_bytes-r"` TxDropped float64 `json:"tx_dropped"` TxErrors float64 `json:"tx_errors"` TxPackets float64 `json:"tx_packets"` Type string `json:"type"` Up FlexBool `json:"up"` UplinkMac string `json:"uplink_mac"` UplinkRemotePort int `json:"uplink_remote_port"` } `json:"uplink"` UplinkTable []interface{} `json:"uplink_table"` Uptime FlexInt `json:"uptime"` UserNumSta int `json:"user-num_sta"` VapTable []struct { ApMac string `json:"ap_mac"` Bssid string `json:"bssid"` Ccq int `json:"ccq"` Channel int `json:"channel"` Essid string `json:"essid"` Extchannel int `json:"extchannel"` ID string `json:"id"` IsGuest FlexBool `json:"is_guest"` IsWep FlexBool `json:"is_wep"` MacFilterRejections int `json:"mac_filter_rejections"` MapID string `json:"map_id"` Name string `json:"name"` NumSta int `json:"num_sta"` Radio string `json:"radio"` RadioName string `json:"radio_name"` RxBytes float64 `json:"rx_bytes"` RxCrypts float64 `json:"rx_crypts"` RxDropped float64 `json:"rx_dropped"` RxErrors float64 `json:"rx_errors"` RxFrags float64 `json:"rx_frags"` RxNwids float64 `json:"rx_nwids"` RxPackets float64 `json:"rx_packets"` SiteID string `json:"site_id"` SiteName string `json:"-"` State string `json:"state"` T string `json:"t"` TxBytes float64 `json:"tx_bytes"` TxDropped float64 `json:"tx_dropped"` TxErrors float64 `json:"tx_errors"` TxLatencyAvg float64 `json:"tx_latency_avg"` TxLatencyMax float64 `json:"tx_latency_max"` TxLatencyMin float64 `json:"tx_latency_min"` TxPackets float64 `json:"tx_packets"` TxPower FlexInt `json:"tx_power"` TxRetries int `json:"tx_retries"` Up FlexBool `json:"up"` Usage string `json:"usage"` WlanconfID string `json:"wlanconf_id"` } `json:"vap_table"` Version string `json:"version"` VersionIncompatible FlexBool `json:"version_incompatible"` VwireEnabled FlexBool `json:"vwireEnabled"` VwireTable []interface{} `json:"vwire_table"` VwireVapTable []struct { Bssid string `json:"bssid"` Radio string `json:"radio"` RadioName string `json:"radio_name"` State string `json:"state"` } `json:"vwire_vap_table"` WifiCaps int `json:"wifi_caps"` }
UAP represents all the data from the Ubiquiti Controller for a Unifi Access Point.
type UCL ¶
type UCL struct { ID string `json:"_id"` IsGuestByUAP FlexBool `json:"_is_guest_by_uap"` IsGuestByUGW FlexBool `json:"_is_guest_by_ugw"` IsGuestByUSW FlexBool `json:"_is_guest_by_usw"` LastSeenByUAP int64 `json:"_last_seen_by_uap"` LastSeenByUGW int64 `json:"_last_seen_by_ugw"` LastSeenByUSW int64 `json:"_last_seen_by_usw"` UptimeByUAP int64 `json:"_uptime_by_uap"` UptimeByUGW int64 `json:"_uptime_by_ugw"` UptimeByUSW int64 `json:"_uptime_by_usw"` ApMac string `json:"ap_mac"` AssocTime int64 `json:"assoc_time"` Authorized FlexBool `json:"authorized"` Bssid string `json:"bssid"` BytesR int64 `json:"bytes-r"` Ccq int64 `json:"ccq"` Channel int `json:"channel"` DevCat int `json:"dev_cat"` DevFamily int `json:"dev_family"` DevID int `json:"dev_id"` DpiStats struct { App int64 Cat int64 RxBytes int64 RxPackets int64 TxBytes int64 TxPackets int64 } `json:"dpi_stats"` DpiStatsLastUpdated int64 `json:"dpi_stats_last_updated"` Essid string `json:"essid"` FirstSeen int64 `json:"first_seen"` FixedIP string `json:"fixed_ip"` Hostname string `json:"hostname"` GwMac string `json:"gw_mac"` IdleTime int64 `json:"idle_time"` IP string `json:"ip"` Is11R FlexBool `json:"is_11r"` IsGuest FlexBool `json:"is_guest"` IsWired FlexBool `json:"is_wired"` LastSeen int64 `json:"last_seen"` LatestAssocTime int64 `json:"latest_assoc_time"` Mac string `json:"mac"` Name string `json:"name"` Network string `json:"network"` NetworkID string `json:"network_id"` Noise int64 `json:"noise"` Note string `json:"note"` Noted FlexBool `json:"noted"` OsClass int `json:"os_class"` OsName int `json:"os_name"` Oui string `json:"oui"` PowersaveEnabled FlexBool `json:"powersave_enabled"` QosPolicyApplied FlexBool `json:"qos_policy_applied"` Radio string `json:"radio"` RadioName string `json:"radio_name"` RadioProto string `json:"radio_proto"` RoamCount int64 `json:"roam_count"` Rssi int64 `json:"rssi"` RxBytes int64 `json:"rx_bytes"` RxBytesR int64 `json:"rx_bytes-r"` RxPackets int64 `json:"rx_packets"` RxRate int64 `json:"rx_rate"` Signal int64 `json:"signal"` SiteID string `json:"site_id"` SiteName string `json:"-"` SwDepth int `json:"sw_depth"` SwMac string `json:"sw_mac"` SwPort int `json:"sw_port"` TxBytes int64 `json:"tx_bytes"` TxBytesR int64 `json:"tx_bytes-r"` TxPackets int64 `json:"tx_packets"` TxPower int64 `json:"tx_power"` TxRate int64 `json:"tx_rate"` Uptime int64 `json:"uptime"` UserID string `json:"user_id"` UserGroupID string `json:"usergroup_id"` UseFixedIP FlexBool `json:"use_fixedip"` Vlan int `json:"vlan"` WiredRxBytes int64 `json:"wired-rx_bytes"` WiredRxBytesR int64 `json:"wired-rx_bytes-r"` WiredRxPackets int64 `json:"wired-rx_packets"` WiredTxBytes int64 `json:"wired-tx_bytes"` WiredTxBytesR int64 `json:"wired-tx_bytes-r"` WiredTxPackets int64 `json:"wired-tx_packets"` }
UCL defines all the data a connected-network client contains.
type USG ¶
type USG struct { ID string `json:"_id"` UUptime float64 `json:"_uptime"` AdoptIP string `json:"adopt_ip"` AdoptURL string `json:"adopt_url"` Adopted FlexBool `json:"adopted"` Bytes float64 `json:"bytes"` Cfgversion string `json:"cfgversion"` ConfigNetwork struct { IP string `json:"ip"` Type string `json:"type"` } `json:"config_network"` ConfigNetworkWan struct { Type string `json:"type"` } `json:"config_network_wan"` ConnectRequestIP string `json:"connect_request_ip"` ConnectRequestPort string `json:"connect_request_port"` ConsideredLostAt float64 `json:"considered_lost_at"` Default FlexBool `json:"default"` DeviceID string `json:"device_id"` DiscoveredVia string `json:"discovered_via"` EthernetTable []struct { Mac string `json:"mac"` Name string `json:"name"` NumPort float64 `json:"num_port"` } `json:"ethernet_table"` FwCaps float64 `json:"fw_caps"` GuestNumSta float64 `json:"guest-num_sta"` GuestToken string `json:"guest_token"` InformIP string `json:"inform_ip"` InformURL string `json:"inform_url"` IP string `json:"ip"` KnownCfgversion string `json:"known_cfgversion"` LastSeen float64 `json:"last_seen"` LedOverride string `json:"led_override"` LicenseState string `json:"license_state"` Locating FlexBool `json:"locating"` Mac string `json:"mac"` Model string `json:"model"` Name string `json:"name"` NetworkTable []struct { ID string `json:"_id"` DhcpdDNSEnabled FlexBool `json:"dhcpd_dns_enabled"` DhcpdEnabled FlexBool `json:"dhcpd_enabled"` DhcpdIP1 string `json:"dhcpd_ip_1,omitempty"` DhcpdLeasetime json.Number `json:"dhcpd_leasetime,Number"` DhcpdStart string `json:"dhcpd_start"` DhcpdStop string `json:"dhcpd_stop"` DhcpdWinsEnabled FlexBool `json:"dhcpd_wins_enabled,omitempty"` DhcpguardEnabled FlexBool `json:"dhcpguard_enabled,omitempty"` DomainName string `json:"domain_name"` Enabled FlexBool `json:"enabled"` IgmpSnooping FlexBool `json:"igmp_snooping,omitempty"` IP string `json:"ip"` IPSubnet string `json:"ip_subnet"` IsGuest FlexBool `json:"is_guest"` IsNat FlexBool `json:"is_nat"` Mac string `json:"mac"` Name string `json:"name"` Networkgroup string `json:"networkgroup"` NumSta float64 `json:"num_sta"` Purpose string `json:"purpose"` RxBytes FlexInt `json:"rx_bytes"` RxPackets float64 `json:"rx_packets"` SiteID string `json:"site_id"` SiteName string `json:"-"` TxBytes FlexInt `json:"tx_bytes"` TxPackets float64 `json:"tx_packets"` Up FlexBool `json:"up"` Vlan string `json:"vlan,omitempty"` VlanEnabled FlexBool `json:"vlan_enabled"` DhcpRelayEnabled FlexBool `json:"dhcp_relay_enabled,omitempty"` DhcpdGatewayEnabled FlexBool `json:"dhcpd_gateway_enabled,omitempty"` DhcpdNtp1 string `json:"dhcpd_ntp_1,omitempty"` DhcpdNtpEnabled FlexBool `json:"dhcpd_ntp_enabled,omitempty"` DhcpdTimeOffsetEnabled FlexBool `json:"dhcpd_time_offset_enabled,omitempty"` DhcpdUnifiController string `json:"dhcpd_unifi_controller,omitempty"` Ipv6InterfaceType string `json:"ipv6_interface_type,omitempty"` AttrHiddenID string `json:"attr_hidden_id,omitempty"` AttrNoDelete FlexBool `json:"attr_no_delete,omitempty"` UpnpLanEnabled FlexBool `json:"upnp_lan_enabled,omitempty"` } `json:"network_table"` NextHeartbeatAt float64 `json:"next_heartbeat_at"` NumDesktop float64 `json:"num_desktop"` NumHandheld float64 `json:"num_handheld"` NumMobile float64 `json:"num_mobile"` NumSta float64 `json:"num_sta"` OutdoorModeOverride string `json:"outdoor_mode_override"` PortTable []struct { DNS []string `json:"dns,omitempty"` Enable FlexBool `json:"enable"` FullDuplex FlexBool `json:"full_duplex"` Gateway string `json:"gateway,omitempty"` Ifname string `json:"ifname"` IP string `json:"ip"` Mac string `json:"mac"` Name string `json:"name"` Netmask string `json:"netmask"` RxBytes FlexInt `json:"rx_bytes"` RxDropped float64 `json:"rx_dropped"` RxErrors float64 `json:"rx_errors"` RxMulticast float64 `json:"rx_multicast"` RxPackets float64 `json:"rx_packets"` Speed float64 `json:"speed"` TxBytes FlexInt `json:"tx_bytes"` TxDropped float64 `json:"tx_dropped"` TxErrors float64 `json:"tx_errors"` TxPackets float64 `json:"tx_packets"` Up FlexBool `json:"up"` } `json:"port_table"` Rollupgrade FlexBool `json:"rollupgrade"` RxBytes FlexInt `json:"rx_bytes"` Serial string `json:"serial"` SiteID string `json:"site_id"` SiteName string `json:"-"` SpeedtestStatus struct { Latency float64 `json:"latency"` Rundate float64 `json:"rundate"` Runtime float64 `json:"runtime"` StatusDownload float64 `json:"status_download"` StatusPing float64 `json:"status_ping"` StatusSummary float64 `json:"status_summary"` StatusUpload float64 `json:"status_upload"` XputDownload float64 `json:"xput_download"` XputUpload float64 `json:"xput_upload"` } `json:"speedtest-status"` SpeedtestStatusSaved FlexBool `json:"speedtest-status-saved"` Stat struct { Datetime string `json:"datetime"` Duration float64 `json:"duration"` Gw string `json:"gw"` LanRxBytes float64 `json:"lan-rx_bytes"` LanRxPackets float64 `json:"lan-rx_packets"` LanTxBytes float64 `json:"lan-tx_bytes"` LanTxPackets float64 `json:"lan-tx_packets"` O string `json:"o"` Oid string `json:"oid"` SiteID string `json:"site_id"` Time float64 `json:"time"` WanRxBytes float64 `json:"wan-rx_bytes"` WanRxDropped float64 `json:"wan-rx_dropped"` WanRxPackets float64 `json:"wan-rx_packets"` WanTxBytes float64 `json:"wan-tx_bytes"` WanTxPackets float64 `json:"wan-tx_packets"` } `json:"stat"` State float64 `json:"state"` SysStats struct { Loadavg1 float64 `json:"loadavg_1,string"` Loadavg15 float64 `json:"loadavg_15,string"` Loadavg5 float64 `json:"loadavg_5,string"` MemBuffer float64 `json:"mem_buffer"` MemTotal float64 `json:"mem_total"` MemUsed float64 `json:"mem_used"` } `json:"sys_stats"` SystemStats struct { CPU float64 `json:"cpu,string"` Mem float64 `json:"mem,string"` Uptime float64 `json:"uptime,string"` } `json:"system-stats"` TxBytes FlexInt `json:"tx_bytes"` Type string `json:"type"` Upgradable FlexBool `json:"upgradable"` Uplink struct { BytesR float64 `json:"bytes-r"` Drops float64 `json:"drops"` Enable FlexBool `json:"enable"` FullDuplex FlexBool `json:"full_duplex"` Gateways []string `json:"gateways"` IP string `json:"ip"` Latency float64 `json:"latency"` Mac string `json:"mac"` MaxSpeed float64 `json:"max_speed"` Name string `json:"name"` Nameservers []string `json:"nameservers"` Netmask string `json:"netmask"` NumPort float64 `json:"num_port"` RxBytes FlexInt `json:"rx_bytes"` RxBytesR float64 `json:"rx_bytes-r"` RxDropped float64 `json:"rx_dropped"` RxErrors float64 `json:"rx_errors"` RxMulticast float64 `json:"rx_multicast"` RxPackets float64 `json:"rx_packets"` Speed float64 `json:"speed"` SpeedtestLastrun float64 `json:"speedtest_lastrun"` SpeedtestPing float64 `json:"speedtest_ping"` SpeedtestStatus string `json:"speedtest_status"` TxBytes FlexInt `json:"tx_bytes"` TxBytesR float64 `json:"tx_bytes-r"` TxDropped float64 `json:"tx_dropped"` TxErrors float64 `json:"tx_errors"` TxPackets float64 `json:"tx_packets"` Type string `json:"type"` Up FlexBool `json:"up"` Uptime float64 `json:"uptime"` XputDown float64 `json:"xput_down"` XputUp float64 `json:"xput_up"` } `json:"uplink"` Uptime float64 `json:"uptime"` UserNumSta float64 `json:"user-num_sta"` UsgCaps float64 `json:"usg_caps"` Version string `json:"version"` VersionIncompatible FlexBool `json:"version_incompatible"` Wan1 struct { BytesR float64 `json:"bytes-r"` DNS []string `json:"dns"` Enable FlexBool `json:"enable"` FullDuplex FlexBool `json:"full_duplex"` Gateway string `json:"gateway"` Ifname string `json:"ifname"` IP string `json:"ip"` Mac string `json:"mac"` MaxSpeed float64 `json:"max_speed"` Name string `json:"name"` Netmask string `json:"netmask"` RxBytes FlexInt `json:"rx_bytes"` RxBytesR float64 `json:"rx_bytes-r"` RxDropped float64 `json:"rx_dropped"` RxErrors float64 `json:"rx_errors"` RxMulticast float64 `json:"rx_multicast"` RxPackets float64 `json:"rx_packets"` Speed float64 `json:"speed"` TxBytes FlexInt `json:"tx_bytes"` TxBytesR float64 `json:"tx_bytes-r"` TxDropped float64 `json:"tx_dropped"` TxErrors float64 `json:"tx_errors"` TxPackets float64 `json:"tx_packets"` Type string `json:"type"` Up FlexBool `json:"up"` } `json:"wan1"` Wan2 struct { BytesR float64 `json:"bytes-r"` DNS []string `json:"dns"` Enable FlexBool `json:"enable"` FullDuplex FlexBool `json:"full_duplex"` Gateway string `json:"gateway"` Ifname string `json:"ifname"` IP string `json:"ip"` Mac string `json:"mac"` MaxSpeed float64 `json:"max_speed"` Name string `json:"name"` Netmask string `json:"netmask"` RxBytes FlexInt `json:"rx_bytes"` RxBytesR float64 `json:"rx_bytes-r"` RxDropped float64 `json:"rx_dropped"` RxErrors float64 `json:"rx_errors"` RxMulticast float64 `json:"rx_multicast"` RxPackets float64 `json:"rx_packets"` Speed float64 `json:"speed"` TxBytes FlexInt `json:"tx_bytes"` TxBytesR float64 `json:"tx_bytes-r"` TxDropped float64 `json:"tx_dropped"` TxErrors float64 `json:"tx_errors"` TxPackets float64 `json:"tx_packets"` Type string `json:"type"` Up FlexBool `json:"up"` } `json:"wan2"` }
USG represents all the data from the Ubiquiti Controller for a Unifi Security Gateway.
type USW ¶
type USW struct { ID string `json:"_id"` UUptime float64 `json:"_uptime"` AdoptIP string `json:"adopt_ip"` AdoptURL string `json:"adopt_url"` Adopted FlexBool `json:"adopted"` BoardRev float64 `json:"board_rev"` Bytes float64 `json:"bytes"` Cfgversion string `json:"cfgversion"` ConfigNetwork struct { IP string `json:"ip"` Type string `json:"type"` } `json:"config_network"` ConnectRequestIP string `json:"connect_request_ip"` ConnectRequestPort string `json:"connect_request_port"` ConsideredLostAt float64 `json:"considered_lost_at"` Default FlexBool `json:"default"` DeviceID string `json:"device_id"` DhcpServerTable []interface{} `json:"dhcp_server_table"` DiscoveredVia string `json:"discovered_via"` Dot1XPortctrlEnabled FlexBool `json:"dot1x_portctrl_enabled"` DownlinkTable []struct { FullDuplex FlexBool `json:"full_duplex"` Mac string `json:"mac"` PortIdx float64 `json:"port_idx"` Speed float64 `json:"speed"` } `json:"downlink_table"` EthernetTable []struct { Mac string `json:"mac"` Name string `json:"name"` NumPort float64 `json:"num_port,omitempty"` } `json:"ethernet_table"` FanLevel float64 `json:"fan_level"` FlowctrlEnabled FlexBool `json:"flowctrl_enabled"` FwCaps float64 `json:"fw_caps"` GeneralTemperature float64 `json:"general_temperature"` GuestNumSta float64 `json:"guest-num_sta"` HasFan FlexBool `json:"has_fan"` HasTemperature FlexBool `json:"has_temperature"` InformIP string `json:"inform_ip"` InformURL string `json:"inform_url"` IP string `json:"ip"` JumboframeEnabled FlexBool `json:"jumboframe_enabled"` KnownCfgversion string `json:"known_cfgversion"` LastSeen float64 `json:"last_seen"` LastUplink struct { UplinkMac string `json:"uplink_mac"` } `json:"last_uplink"` LedOverride string `json:"led_override"` LicenseState string `json:"license_state"` Locating FlexBool `json:"locating"` Mac string `json:"mac"` Model string `json:"model"` Name string `json:"name"` NextHeartbeatAt float64 `json:"next_heartbeat_at"` NumSta float64 `json:"num_sta"` OutdoorModeOverride string `json:"outdoor_mode_override"` Overheating FlexBool `json:"overheating"` PortOverrides []struct { Name string `json:"name,omitempty"` PoeMode string `json:"poe_mode,omitempty"` PortIdx float64 `json:"port_idx"` PortconfID string `json:"portconf_id"` } `json:"port_overrides"` PortTable []struct { AggregatedBy FlexBool `json:"aggregated_by"` Autoneg FlexBool `json:"autoneg"` BytesR FlexInt `json:"bytes-r"` Dot1XMode string `json:"dot1x_mode"` Dot1XStatus string `json:"dot1x_status"` Enable FlexBool `json:"enable"` FlowctrlRx FlexBool `json:"flowctrl_rx"` FlowctrlTx FlexBool `json:"flowctrl_tx"` FullDuplex FlexBool `json:"full_duplex"` IsUplink FlexBool `json:"is_uplink"` Jumbo FlexBool `json:"jumbo"` LldpTable []interface{} `json:"lldp_table"` Masked FlexBool `json:"masked"` Media string `json:"media"` Name string `json:"name"` OpMode string `json:"op_mode"` PoeCaps FlexInt `json:"poe_caps"` PoeClass string `json:"poe_class,omitempty"` PoeCurrent FlexInt `json:"poe_current,omitempty"` PoeEnable FlexBool `json:"poe_enable,omitempty"` PoeGood FlexBool `json:"poe_good,omitempty"` PoeMode string `json:"poe_mode,omitempty"` PoePower FlexInt `json:"poe_power,omitempty"` PoeVoltage FlexInt `json:"poe_voltage,omitempty"` PortIdx FlexInt `json:"port_idx"` PortPoe FlexBool `json:"port_poe"` PortconfID string `json:"portconf_id"` RxBroadcast FlexInt `json:"rx_broadcast"` RxBytes FlexInt `json:"rx_bytes"` RxBytesR FlexInt `json:"rx_bytes-r"` RxDropped FlexInt `json:"rx_dropped"` RxErrors FlexInt `json:"rx_errors"` RxMulticast FlexInt `json:"rx_multicast"` RxPackets FlexInt `json:"rx_packets"` Speed FlexInt `json:"speed"` StpPathcost FlexInt `json:"stp_pathcost"` StpState string `json:"stp_state"` TxBroadcast FlexInt `json:"tx_broadcast"` TxBytes FlexInt `json:"tx_bytes"` TxBytesR FlexInt `json:"tx_bytes-r"` TxDropped FlexInt `json:"tx_dropped"` TxErrors FlexInt `json:"tx_errors"` TxMulticast FlexInt `json:"tx_multicast"` TxPackets FlexInt `json:"tx_packets"` Up FlexBool `json:"up"` SfpFound FlexBool `json:"sfp_found,omitempty"` } `json:"port_table"` Rollupgrade FlexBool `json:"rollupgrade"` RxBytes float64 `json:"rx_bytes"` Serial string `json:"serial"` SiteID string `json:"site_id"` SiteName string `json:"-"` SSHSessionTable []interface{} `json:"ssh_session_table"` Stat struct { Bytes float64 `json:"bytes"` Datetime string `json:"datetime"` Duration float64 `json:"duration"` O string `json:"o"` Oid string `json:"oid"` Port1RxBroadcast float64 `json:"port_1-rx_broadcast"` Port1RxBytes float64 `json:"port_1-rx_bytes"` Port1RxDropped float64 `json:"port_1-rx_dropped"` Port1RxMulticast float64 `json:"port_1-rx_multicast"` Port1RxPackets float64 `json:"port_1-rx_packets"` Port1TxBroadcast float64 `json:"port_1-tx_broadcast"` Port1TxBytes float64 `json:"port_1-tx_bytes"` Port1TxMulticast float64 `json:"port_1-tx_multicast"` Port1TxPackets float64 `json:"port_1-tx_packets"` Port2RxBroadcast float64 `json:"port_2-rx_broadcast"` Port2RxBytes float64 `json:"port_2-rx_bytes"` Port2RxDropped float64 `json:"port_2-rx_dropped"` Port2RxMulticast float64 `json:"port_2-rx_multicast"` Port2RxPackets float64 `json:"port_2-rx_packets"` Port2TxBroadcast float64 `json:"port_2-tx_broadcast"` Port2TxBytes float64 `json:"port_2-tx_bytes"` Port2TxMulticast float64 `json:"port_2-tx_multicast"` Port2TxPackets float64 `json:"port_2-tx_packets"` Port3RxBroadcast float64 `json:"port_3-rx_broadcast"` Port3RxBytes float64 `json:"port_3-rx_bytes"` Port3RxDropped float64 `json:"port_3-rx_dropped"` Port3RxMulticast float64 `json:"port_3-rx_multicast"` Port3RxPackets float64 `json:"port_3-rx_packets"` Port3TxBroadcast float64 `json:"port_3-tx_broadcast"` Port3TxBytes float64 `json:"port_3-tx_bytes"` Port3TxMulticast float64 `json:"port_3-tx_multicast"` Port3TxPackets float64 `json:"port_3-tx_packets"` Port4RxBroadcast float64 `json:"port_4-rx_broadcast"` Port4RxBytes float64 `json:"port_4-rx_bytes"` Port4RxDropped float64 `json:"port_4-rx_dropped"` Port4RxMulticast float64 `json:"port_4-rx_multicast"` Port4RxPackets float64 `json:"port_4-rx_packets"` Port4TxBroadcast float64 `json:"port_4-tx_broadcast"` Port4TxBytes float64 `json:"port_4-tx_bytes"` Port4TxMulticast float64 `json:"port_4-tx_multicast"` Port4TxPackets float64 `json:"port_4-tx_packets"` Port5RxBroadcast float64 `json:"port_5-rx_broadcast"` Port5RxBytes float64 `json:"port_5-rx_bytes"` Port5RxDropped float64 `json:"port_5-rx_dropped"` Port5RxMulticast float64 `json:"port_5-rx_multicast"` Port5RxPackets float64 `json:"port_5-rx_packets"` Port5TxBroadcast float64 `json:"port_5-tx_broadcast"` Port5TxBytes float64 `json:"port_5-tx_bytes"` Port5TxMulticast float64 `json:"port_5-tx_multicast"` Port5TxPackets float64 `json:"port_5-tx_packets"` Port6RxBroadcast float64 `json:"port_6-rx_broadcast"` Port6RxBytes float64 `json:"port_6-rx_bytes"` Port6RxDropped float64 `json:"port_6-rx_dropped"` Port6RxMulticast float64 `json:"port_6-rx_multicast"` Port6RxPackets float64 `json:"port_6-rx_packets"` Port6TxBroadcast float64 `json:"port_6-tx_broadcast"` Port6TxBytes float64 `json:"port_6-tx_bytes"` Port6TxMulticast float64 `json:"port_6-tx_multicast"` Port6TxPackets float64 `json:"port_6-tx_packets"` Port7RxBroadcast float64 `json:"port_7-rx_broadcast"` Port7RxBytes float64 `json:"port_7-rx_bytes"` Port7RxDropped float64 `json:"port_7-rx_dropped"` Port7RxMulticast float64 `json:"port_7-rx_multicast"` Port7RxPackets float64 `json:"port_7-rx_packets"` Port7TxBroadcast float64 `json:"port_7-tx_broadcast"` Port7TxBytes float64 `json:"port_7-tx_bytes"` Port7TxMulticast float64 `json:"port_7-tx_multicast"` Port7TxPackets float64 `json:"port_7-tx_packets"` Port8RxBroadcast float64 `json:"port_8-rx_broadcast"` Port8RxBytes float64 `json:"port_8-rx_bytes"` Port8RxDropped float64 `json:"port_8-rx_dropped"` Port8RxMulticast float64 `json:"port_8-rx_multicast"` Port8RxPackets float64 `json:"port_8-rx_packets"` Port8TxBroadcast float64 `json:"port_8-tx_broadcast"` Port8TxBytes float64 `json:"port_8-tx_bytes"` Port8TxMulticast float64 `json:"port_8-tx_multicast"` Port8TxPackets float64 `json:"port_8-tx_packets"` Port9RxBroadcast float64 `json:"port_9-rx_broadcast"` Port9RxBytes float64 `json:"port_9-rx_bytes"` Port9RxDropped float64 `json:"port_9-rx_dropped"` Port9RxMulticast float64 `json:"port_9-rx_multicast"` Port9RxPackets float64 `json:"port_9-rx_packets"` Port9TxBroadcast float64 `json:"port_9-tx_broadcast"` Port9TxBytes float64 `json:"port_9-tx_bytes"` Port9TxMulticast float64 `json:"port_9-tx_multicast"` Port9TxPackets float64 `json:"port_9-tx_packets"` Port10RxBroadcast float64 `json:"port_10-rx_broadcast"` Port10RxBytes float64 `json:"port_10-rx_bytes"` Port10RxDropped float64 `json:"port_10-rx_dropped"` Port10RxMulticast float64 `json:"port_10-rx_multicast"` Port10RxPackets float64 `json:"port_10-rx_packets"` Port10TxBroadcast float64 `json:"port_10-tx_broadcast"` Port10TxBytes float64 `json:"port_10-tx_bytes"` Port10TxMulticast float64 `json:"port_10-tx_multicast"` Port10TxPackets float64 `json:"port_10-tx_packets"` Port11RxBroadcast float64 `json:"port_11-rx_broadcast"` Port11RxBytes float64 `json:"port_11-rx_bytes"` Port11RxDropped float64 `json:"port_11-rx_dropped"` Port11RxMulticast float64 `json:"port_11-rx_multicast"` Port11RxPackets float64 `json:"port_11-rx_packets"` Port11TxBroadcast float64 `json:"port_11-tx_broadcast"` Port11TxBytes float64 `json:"port_11-tx_bytes"` Port11TxMulticast float64 `json:"port_11-tx_multicast"` Port11TxPackets float64 `json:"port_11-tx_packets"` Port12RxBroadcast float64 `json:"port_12-rx_broadcast"` Port12RxBytes float64 `json:"port_12-rx_bytes"` Port12RxDropped float64 `json:"port_12-rx_dropped"` Port12RxMulticast float64 `json:"port_12-rx_multicast"` Port12RxPackets float64 `json:"port_12-rx_packets"` Port12TxBroadcast float64 `json:"port_12-tx_broadcast"` Port12TxBytes float64 `json:"port_12-tx_bytes"` Port12TxMulticast float64 `json:"port_12-tx_multicast"` Port12TxPackets float64 `json:"port_12-tx_packets"` Port13RxBroadcast float64 `json:"port_13-rx_broadcast"` Port13RxBytes float64 `json:"port_13-rx_bytes"` Port13RxDropped float64 `json:"port_13-rx_dropped"` Port13RxMulticast float64 `json:"port_13-rx_multicast"` Port13RxPackets float64 `json:"port_13-rx_packets"` Port13TxBroadcast float64 `json:"port_13-tx_broadcast"` Port13TxBytes float64 `json:"port_13-tx_bytes"` Port13TxMulticast float64 `json:"port_13-tx_multicast"` Port13TxPackets float64 `json:"port_13-tx_packets"` Port14RxBroadcast float64 `json:"port_14-rx_broadcast"` Port14RxBytes float64 `json:"port_14-rx_bytes"` Port14RxDropped float64 `json:"port_14-rx_dropped"` Port14RxMulticast float64 `json:"port_14-rx_multicast"` Port14RxPackets float64 `json:"port_14-rx_packets"` Port14TxBroadcast float64 `json:"port_14-tx_broadcast"` Port14TxBytes float64 `json:"port_14-tx_bytes"` Port14TxMulticast float64 `json:"port_14-tx_multicast"` Port14TxPackets float64 `json:"port_14-tx_packets"` Port15RxBroadcast float64 `json:"port_15-rx_broadcast"` Port15RxBytes float64 `json:"port_15-rx_bytes"` Port15RxDropped float64 `json:"port_15-rx_dropped"` Port15RxMulticast float64 `json:"port_15-rx_multicast"` Port15RxPackets float64 `json:"port_15-rx_packets"` Port15TxBroadcast float64 `json:"port_15-tx_broadcast"` Port15TxBytes float64 `json:"port_15-tx_bytes"` Port15TxMulticast float64 `json:"port_15-tx_multicast"` Port15TxPackets float64 `json:"port_15-tx_packets"` Port16RxBroadcast float64 `json:"port_16-rx_broadcast"` Port16RxBytes float64 `json:"port_16-rx_bytes"` Port16RxDropped float64 `json:"port_16-rx_dropped"` Port16RxMulticast float64 `json:"port_16-rx_multicast"` Port16RxPackets float64 `json:"port_16-rx_packets"` Port16TxBroadcast float64 `json:"port_16-tx_broadcast"` Port16TxBytes float64 `json:"port_16-tx_bytes"` Port16TxMulticast float64 `json:"port_16-tx_multicast"` Port16TxPackets float64 `json:"port_16-tx_packets"` Port17RxBroadcast float64 `json:"port_17-rx_broadcast"` Port17RxBytes float64 `json:"port_17-rx_bytes"` Port17RxDropped float64 `json:"port_17-rx_dropped"` Port17RxMulticast float64 `json:"port_17-rx_multicast"` Port17RxPackets float64 `json:"port_17-rx_packets"` Port17TxBroadcast float64 `json:"port_17-tx_broadcast"` Port17TxBytes float64 `json:"port_17-tx_bytes"` Port17TxMulticast float64 `json:"port_17-tx_multicast"` Port17TxPackets float64 `json:"port_17-tx_packets"` Port18RxBroadcast float64 `json:"port_18-rx_broadcast"` Port18RxBytes float64 `json:"port_18-rx_bytes"` Port18RxDropped float64 `json:"port_18-rx_dropped"` Port18RxMulticast float64 `json:"port_18-rx_multicast"` Port18RxPackets float64 `json:"port_18-rx_packets"` Port18TxBroadcast float64 `json:"port_18-tx_broadcast"` Port18TxBytes float64 `json:"port_18-tx_bytes"` Port18TxMulticast float64 `json:"port_18-tx_multicast"` Port18TxPackets float64 `json:"port_18-tx_packets"` Port19RxBroadcast float64 `json:"port_19-rx_broadcast"` Port19RxBytes float64 `json:"port_19-rx_bytes"` Port19RxDropped float64 `json:"port_19-rx_dropped"` Port19RxMulticast float64 `json:"port_19-rx_multicast"` Port19RxPackets float64 `json:"port_19-rx_packets"` Port19TxBroadcast float64 `json:"port_19-tx_broadcast"` Port19TxBytes float64 `json:"port_19-tx_bytes"` Port19TxMulticast float64 `json:"port_19-tx_multicast"` Port19TxPackets float64 `json:"port_19-tx_packets"` Port20RxBroadcast float64 `json:"port_20-rx_broadcast"` Port20RxBytes float64 `json:"port_20-rx_bytes"` Port20RxDropped float64 `json:"port_20-rx_dropped"` Port20RxMulticast float64 `json:"port_20-rx_multicast"` Port20RxPackets float64 `json:"port_20-rx_packets"` Port20TxBroadcast float64 `json:"port_20-tx_broadcast"` Port20TxBytes float64 `json:"port_20-tx_bytes"` Port20TxMulticast float64 `json:"port_20-tx_multicast"` Port20TxPackets float64 `json:"port_20-tx_packets"` Port21RxBroadcast float64 `json:"port_21-rx_broadcast"` Port21RxBytes float64 `json:"port_21-rx_bytes"` Port21RxDropped float64 `json:"port_21-rx_dropped"` Port21RxMulticast float64 `json:"port_21-rx_multicast"` Port21RxPackets float64 `json:"port_21-rx_packets"` Port21TxBroadcast float64 `json:"port_21-tx_broadcast"` Port21TxBytes float64 `json:"port_21-tx_bytes"` Port21TxMulticast float64 `json:"port_21-tx_multicast"` Port21TxPackets float64 `json:"port_21-tx_packets"` Port22RxBroadcast float64 `json:"port_22-rx_broadcast"` Port22RxBytes float64 `json:"port_22-rx_bytes"` Port22RxDropped float64 `json:"port_22-rx_dropped"` Port22RxMulticast float64 `json:"port_22-rx_multicast"` Port22RxPackets float64 `json:"port_22-rx_packets"` Port22TxBroadcast float64 `json:"port_22-tx_broadcast"` Port22TxBytes float64 `json:"port_22-tx_bytes"` Port22TxMulticast float64 `json:"port_22-tx_multicast"` Port22TxPackets float64 `json:"port_22-tx_packets"` Port23RxBroadcast float64 `json:"port_23-rx_broadcast"` Port23RxBytes float64 `json:"port_23-rx_bytes"` Port23RxDropped float64 `json:"port_23-rx_dropped"` Port23RxMulticast float64 `json:"port_23-rx_multicast"` Port23RxPackets float64 `json:"port_23-rx_packets"` Port23TxBroadcast float64 `json:"port_23-tx_broadcast"` Port23TxBytes float64 `json:"port_23-tx_bytes"` Port23TxMulticast float64 `json:"port_23-tx_multicast"` Port23TxPackets float64 `json:"port_23-tx_packets"` Port24RxBroadcast float64 `json:"port_24-rx_broadcast"` Port24RxBytes float64 `json:"port_24-rx_bytes"` Port24RxDropped float64 `json:"port_24-rx_dropped"` Port24RxMulticast float64 `json:"port_24-rx_multicast"` Port24RxPackets float64 `json:"port_24-rx_packets"` Port24TxBroadcast float64 `json:"port_24-tx_broadcast"` Port24TxBytes float64 `json:"port_24-tx_bytes"` Port24TxMulticast float64 `json:"port_24-tx_multicast"` Port24TxPackets float64 `json:"port_24-tx_packets"` // Have a 48 port switch? How 'bout a pull request. :D RxBroadcast float64 `json:"rx_broadcast"` RxBytes float64 `json:"rx_bytes"` RxCrypts float64 `json:"rx_crypts"` RxDropped float64 `json:"rx_dropped"` RxErrors float64 `json:"rx_errors"` RxFrags float64 `json:"rx_frags"` RxMulticast float64 `json:"rx_multicast"` RxPackets float64 `json:"rx_packets"` SiteID string `json:"site_id"` Sw string `json:"sw"` Time float64 `json:"time"` TxBroadcast float64 `json:"tx_broadcast"` TxBytes float64 `json:"tx_bytes"` TxDropped float64 `json:"tx_dropped"` TxErrors float64 `json:"tx_errors"` TxMulticast float64 `json:"tx_multicast"` TxPackets float64 `json:"tx_packets"` TxRetries float64 `json:"tx_retries"` } `json:"stat"` State float64 `json:"state"` StpPriority string `json:"stp_priority"` StpVersion string `json:"stp_version"` SysStats struct { Loadavg1 float64 `json:"loadavg_1,string"` Loadavg15 float64 `json:"loadavg_15,string"` Loadavg5 float64 `json:"loadavg_5,string"` MemBuffer float64 `json:"mem_buffer"` MemTotal float64 `json:"mem_total"` MemUsed float64 `json:"mem_used"` } `json:"sys_stats"` SystemStats struct { CPU float64 `json:"cpu,string"` Mem float64 `json:"mem,string"` Uptime float64 `json:"uptime,string"` } `json:"system-stats"` TxBytes float64 `json:"tx_bytes"` Type string `json:"type"` Upgradable FlexBool `json:"upgradable"` Uplink struct { FullDuplex FlexBool `json:"full_duplex"` IP string `json:"ip"` Mac string `json:"mac"` MaxSpeed float64 `json:"max_speed"` Media string `json:"media"` Name string `json:"name"` Netmask string `json:"netmask"` NumPort float64 `json:"num_port"` PortIdx float64 `json:"port_idx"` RxBytes float64 `json:"rx_bytes"` RxBytesR float64 `json:"rx_bytes-r"` RxDropped float64 `json:"rx_dropped"` RxErrors float64 `json:"rx_errors"` RxMulticast float64 `json:"rx_multicast"` RxPackets float64 `json:"rx_packets"` Speed float64 `json:"speed"` TxBytes float64 `json:"tx_bytes"` TxBytesR float64 `json:"tx_bytes-r"` TxDropped float64 `json:"tx_dropped"` TxErrors float64 `json:"tx_errors"` TxPackets float64 `json:"tx_packets"` Type string `json:"type"` Up FlexBool `json:"up"` UplinkMac string `json:"uplink_mac"` } `json:"uplink"` UplinkDepth FlexInt `json:"uplink_depth"` Uptime float64 `json:"uptime"` UserNumSta float64 `json:"user-num_sta"` Version string `json:"version"` VersionIncompatible FlexBool `json:"version_incompatible"` }
USW represents all the data from the Ubiquiti Controller for a Unifi Switch.
type Unifi ¶
type Unifi struct { *http.Client ErrorLog Logger DebugLog Logger // contains filtered or unexported fields }
Unifi is what you get in return for providing a password! Unifi represents a controller that you can make authenticated requests to. Use this to make additional requests for devices, clients or other custom data.
func NewUnifi ¶
NewUnifi creates a http.Client with authenticated cookies. Used to make additional, authenticated requests to the APIs. Start here.
func (*Unifi) GetClients ¶
GetClients returns a response full of clients' data from the Unifi Controller.
func (*Unifi) GetData ¶
GetData makes a unifi request and unmarshal the response into a provided pointer.
func (*Unifi) GetDevices ¶
GetDevices returns a response full of devices' data from the Unifi Controller.