Documentation ¶
Overview ¶
nolint: revive
nolint: revive Package unifi provides a set of types to unload (unmarshal) Ubiquiti UniFi 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
- Variables
- type Alarm
- type Anomaly
- type Ap
- type Camera
- type Client
- type Config
- type ConfigNetwork
- type ConfigNetworkLan
- type DPIClient
- type DPIData
- type DPIMap
- type DPITable
- type Devices
- type DownlinkTable
- type EthernetOverrides
- type EthernetTable
- type Event
- type FlexBool
- type FlexInt
- func (f *FlexInt) Add(o *FlexInt)
- func (f *FlexInt) AddFloat64(v float64)
- func (f FlexInt) Fake(faker *gofakeit.Faker) interface{}
- func (f *FlexInt) Int() int
- func (f *FlexInt) Int64() int64
- func (f FlexInt) MarshalJSON() ([]byte, error)
- func (f *FlexInt) String() string
- func (f *FlexInt) UnmarshalJSON(b []byte) error
- type FlexString
- type FlexTemp
- func (f *FlexTemp) Add(o *FlexTemp)
- func (f *FlexTemp) AddFloat64(v float64)
- func (f *FlexTemp) Celsius() float64
- func (f *FlexTemp) CelsiusInt() int
- func (f *FlexTemp) CelsiusInt64() int64
- func (f *FlexTemp) Fahrenheit() float64
- func (f *FlexTemp) FahrenheitInt() int
- func (f *FlexTemp) FahrenheitInt64() int64
- func (f FlexTemp) Fake(faker *gofakeit.Faker) interface{}
- func (f FlexTemp) MarshalJSON() ([]byte, error)
- func (f *FlexTemp) String() string
- func (f *FlexTemp) UnmarshalJSON(b []byte) error
- type GeoInfo
- type Gw
- type IDS
- type IPGeo
- type LedState
- type Logger
- type MacTable
- type Network
- type NetworkTable
- type OutletOverride
- type OutletTable
- type PDU
- type PDUStat
- type Port
- type PortDelta
- type RadioTable
- type RadioTableStats
- type RogueAP
- type ServerStatus
- type Site
- func (s *Site) Adopt(mac string) error
- func (s *Site) CancelMigrate(mac string) error
- func (s *Site) Locate(mac string) error
- func (s *Site) Migrate(mac string, url string) error
- func (s *Site) Provision(mac string) error
- func (s *Site) Restart(mac string) error
- func (s *Site) SpeedTest() error
- func (s *Site) SpeedTestStatus() ([]byte, error)
- func (s *Site) Unlocate(mac string) error
- func (s *Site) Upgrade(mac string, url string) error
- type SpeedtestServer
- type SpeedtestStatus
- type Storage
- type Sw
- type SwitchCaps
- type SysStats
- type SystemStats
- type TempStatusByName
- type Temperature
- type UAP
- type UAPStat
- type UDM
- type UDMStat
- type USG
- type USGStat
- type USW
- type USWStat
- type UXG
- type UXGStat
- type Unifi
- func (u *Unifi) DownloadClip(cameraID string, start, end time.Time) (*os.File, error)
- func (u *Unifi) GetAlarms(sites []*Site) ([]*Alarm, error)
- func (u *Unifi) GetAlarmsSite(site *Site) ([]*Alarm, error)
- func (u *Unifi) GetAnomalies(sites []*Site, timeRange ...time.Time) ([]*Anomaly, error)
- func (u *Unifi) GetAnomaliesSite(site *Site, timeRange ...time.Time) ([]*Anomaly, error)
- func (u *Unifi) GetCameraByID(value string) (*Camera, error)
- func (u *Unifi) GetCameraByName(value string) (*Camera, error)
- func (u *Unifi) GetCameras() ([]*Camera, error)
- func (u *Unifi) GetClients(sites []*Site) ([]*Client, error)
- func (u *Unifi) GetClientsDPI(sites []*Site) ([]*DPITable, error)
- func (u *Unifi) GetClipBytes(cameraID string, start, end time.Time) ([]byte, error)
- func (u *Unifi) GetData(apiPath string, v interface{}, params ...string) error
- func (u *Unifi) GetDevices(sites []*Site) (*Devices, error)
- func (u *Unifi) GetEvents(sites []*Site, hours time.Duration) ([]*Event, error)
- func (u *Unifi) GetIDS(sites []*Site, timeRange ...time.Time) ([]*IDS, error)
- func (u *Unifi) GetIDSSite(site *Site, timeRange ...time.Time) ([]*IDS, error)
- func (u *Unifi) GetJSON(apiPath string, params ...string) ([]byte, error)
- func (u *Unifi) GetNetworks(sites []*Site) ([]Network, error)
- func (u *Unifi) GetRaw(apiPath string, params ...string) ([]byte, error)
- func (u *Unifi) GetRogueAPs(sites []*Site) ([]*RogueAP, error)
- func (u *Unifi) GetRogueAPsSite(site *Site) ([]*RogueAP, error)
- func (u *Unifi) GetServerData() (*ServerStatus, error)
- func (u *Unifi) GetSiteDPI(sites []*Site) ([]*DPITable, error)
- func (u *Unifi) GetSiteEvents(site *Site, hours time.Duration) ([]*Event, error)
- func (u *Unifi) GetSites() ([]*Site, error)
- func (u *Unifi) GetUAPs(site *Site) ([]*UAP, error)
- func (u *Unifi) GetUDMs(site *Site) ([]*UDM, error)
- func (u *Unifi) GetUSGs(site *Site) ([]*USG, error)
- func (u *Unifi) GetUSWs(site *Site) ([]*USW, error)
- func (u *Unifi) GetUXGs(site *Site) ([]*UXG, error)
- func (u *Unifi) GetUsers(sites []*Site, hours int) ([]*User, error)
- func (u *Unifi) Login() error
- func (u *Unifi) Logout() error
- func (u *Unifi) PostJSON(apiPath string, params ...string) ([]byte, error)
- func (u *Unifi) PutData(apiPath string, v interface{}, params ...string) error
- func (u *Unifi) PutJSON(apiPath string, params ...string) ([]byte, error)
- func (u *Unifi) UniReq(apiPath string, params string) (*http.Request, error)
- func (u *Unifi) UniReqPost(apiPath string, params string) (*http.Request, error)
- func (u *Unifi) UniReqPut(apiPath string, params string) (*http.Request, error)
- type UnifiClient
- type Uplink
- type UptimeStats
- type User
- type VapTable
- type Wan
Constants ¶
const ( DevMgrPowerCycle = "power-cycle" // mac = switch mac (required), port_idx = PoE port to cycle (required) DevMgrAdopt = "adopt" // mac = device mac (required) DevMgrRestart = "restart" // mac = device mac (required) DevMgrForceProvision = "force-provision" // mac = device mac (required) DevMgrSpeedTest = "speedtest" // Start a speed test DevMgrSpeedTestStatus = "speedtest-status" // Get current state of the speed test DevMgrSetLocate = "set-locate" // mac = device mac (required): blink unit to locate DevMgrUnsetLocate = "unset-locate" // mac = device mac (required): led to normal state DevMgrUpgrade = "upgrade" // mac = device mac (required): upgrade firmware DevMgrUpgradeExternal = "upgrade-external" // mac = device mac (required), url = firmware URL (required) DevMgrMigrate = "migrate" // mac = device mac (required), inform_url = New Inform URL for device (required) DevMgrCancelMigrate = "cancel-migrate" // mac = device mac (required) DevMgrSpectrumScan = "spectrum-scan" // mac = AP mac (required): trigger RF scan )
Known commands that can be sent to device manager. All of these are implemented.
const ( // APIRogueAP shows your neighbors' wifis. APIRogueAP string = "/api/s/%s/stat/rogueap" // APIStatusPath shows Controller version. APIStatusPath string = "/status" // APIEventPath contains UniFi Event data. APIEventPath string = "/api/s/%s/stat/event" // APISiteList is the path to the api site list. APISiteList string = "/api/stat/sites" // APISiteDPI is site DPI data. APISiteDPI string = "/api/s/%s/stat/sitedpi" // APISiteDPI is site DPI data. APIClientDPI string = "/api/s/%s/stat/stadpi" // APIClientPath is Unifi Clients API Path. APIClientPath string = "/api/s/%s/stat/sta" // APIAllUserPath is Unifi Insight all previous Clients API Path. APIAllUserPath string = "/api/s/%s/stat/alluser" // APINetworkPath is where we get data about Unifi networks. APINetworkPath string = "/api/s/%s/rest/networkconf" // APIDevicePath is where we get data about Unifi devices. APIDevicePath string = "/api/s/%s/stat/device" // APILoginPath is Unifi Controller Login API Path. APILoginPath string = "/api/login" // APILoginPathNew is how we log into UDM 5.12.55+. APILoginPathNew string = "/api/auth/login" // APILogoutPath is how we logout from UDM. APILogoutPath string = "/api/logout" // APIEventPathIDS returns Intrusion Detection/Prevention Systems Events. APIEventPathIDS string = "/api/s/%s/stat/ips/event" // APIEventPathAlarms contains the site alarms. APIEventPathAlarms string = "/api/s/%s/list/alarm" // APIPrefixNew is the prefix added to the new API paths; except login. duh. APIPrefixNew string = "/proxy/protect" // APIAnomaliesPath returns site anomalies. APIAnomaliesPath string = "/api/s/%s/stat/anomalies" APICommandPath string = "/api/s/%s/cmd" APIDevMgrPath string = APICommandPath + "/devmgr" )
This is a list of unifi API paths. The %s in each string must be replaced with a Site.Name.
Variables ¶
var ( ErrNoSiteProvided = fmt.Errorf("site must not be nil or empty") ErrInvalidTimeRange = fmt.Errorf("only 0, 1 or 2 times may be provided to timeRange") )
var ( ErrCannotUnmarshalFlexInt = fmt.Errorf("cannot unmarshal to FlexInt") ErrCannotUnmarshalFlexString = fmt.Errorf("cannot unmarshal to FlexString") )
var ( ErrAuthenticationFailed = fmt.Errorf("authentication failed") ErrInvalidStatusCode = fmt.Errorf("invalid status code from server") ErrNoParams = fmt.Errorf("requested PUT with no parameters") ErrInvalidSignature = fmt.Errorf("certificate signature does not match") )
var DPIApps = DPIMap{}/* 2279 elements not displayed */
DPIApps maps the applications to names. From: https://fw-download.ubnt.com/data/usg-dpi/1628-debian-v1.442.0-05f5a57eaef344358bd5a8e84a184c18.tar
var DPICats = DPIMap{
0: "Instant Messengers",
1: "Peer-to-Peer Networks",
3: "File Sharing",
4: "Media Streaming",
5: "Email Messaging",
6: "VoIP Services",
7: "Database Tools",
8: "Online Games",
9: "Management Protocols",
10: "Remote Access",
11: "Tunneling and Proxy",
12: "Investment Platforms",
13: "Web Services",
14: "Security Updates",
15: "Web IM",
17: "Business Tools",
18: "Network Protocols_18",
19: "Network Protocols_19",
20: "Network Protocols_20",
23: "Private Protocols",
24: "Social Networks",
255: "Unknown_255",
}
DPICats maps the categories to descriptions. From: https://fw-download.ubnt.com/data/usg-dpi/1628-debian-v1.442.0-05f5a57eaef344358bd5a8e84a184c18.tar
var ErrDPIDataBug = fmt.Errorf("dpi data table contains more than 1 item; please open a bug report")
Functions ¶
This section is empty.
Types ¶
type Alarm ¶
type Alarm struct { AppProto string `json:"app_proto,omitempty"` Archived FlexBool `json:"archived"` Catname FlexString `json:"catname"` Datetime time.Time `fake:"{recent_time}" json:"datetime"` DestIP string `fake:"{ipv4address}" json:"dest_ip"` DestIPGeo IPGeo `json:"dstipGeo"` DestPort int `fake:"{port}" json:"dest_port"` DstIPASN string `json:"dstipASN,omitempty"` DstIPCountry string `json:"dstipCountry,omitempty"` DstMAC string `fake:"{macaddress}" json:"dst_mac"` EventType string `json:"event_type"` FlowID int64 `json:"flow_id"` HandledAdminID string `json:"handled_admin_id,omitempty"` HandledTime time.Time `json:"handled_time,omitempty"` Host string `json:"host"` ID string `fake:"{uuid}" json:"_id"` InIface string `fake:"{randomstring:[eth0,eth1,lan1,wan1,wan2]}" json:"in_iface"` InnerAlertAction string `json:"inner_alert_action"` InnerAlertCategory string `json:"inner_alert_category"` InnerAlertGID int64 `json:"inner_alert_gid"` InnerAlertRev int64 `json:"inner_alert_rev"` InnerAlertSeverity int64 `json:"inner_alert_severity"` InnerAlertSignature string `json:"inner_alert_signature"` InnerAlertSignatureID int64 `json:"inner_alert_signature_id"` Key string `json:"key"` Msg string `fake:"{sentence:5}" json:"msg"` Proto string `json:"proto"` SiteID string `fake:"{uuid}" json:"site_id"` SiteName string `json:"-"` SourceIPGeo IPGeo `json:"usgipGeo"` SourceName string `json:"-"` SrcIP string `fake:"{ipv4address}" json:"src_ip"` SrcIPASN string `json:"srcipASN,omitempty"` SrcIPCountry string `json:"srcipCountry,omitempty"` SrcMAC string `fake:"{macaddress}" json:"src_mac"` SrcPort int `fake:"{port}" json:"src_port"` Subsystem string `json:"subsystem"` Time int64 `fake:"{timestamp}" json:"time"` Timestamp int64 `fake:"{timestamp}" json:"timestamp"` TxID FlexInt `json:"tx_id,omitempty"` USGIP string `fake:"{ipv4address}" json:"usgip"` USGIPASN string `json:"usgipASN"` USGIPCountry string `json:"usgipCountry"` USGIPGeo IPGeo `json:"srcipGeo,omitempty"` UniqueAlertID string `json:"unique_alertid"` }
type Anomaly ¶
type Anomaly struct { // DeviceName string // we do not have this.... Anomaly string Datetime time.Time `fake:"{recent_time}"` DeviceMAC string `fake:"{macaddress}"` SiteName string SourceName string }
Anomaly is the reformatted data type that this library returns.
type Ap ¶
type Ap struct { Ap string `json:"ap"` Bytes FlexInt `json:"bytes"` Datetime time.Time `fake:"{recent_time}" json:"datetime"` Duration FlexInt `json:"duration"` GuestMacFilterRejections FlexInt `json:"guest-mac_filter_rejections"` GuestRxBytes FlexInt `json:"guest-rx_bytes"` GuestRxCrypts FlexInt `json:"guest-rx_crypts"` GuestRxDropped FlexInt `json:"guest-rx_dropped"` GuestRxErrors FlexInt `json:"guest-rx_errors"` GuestRxFrags FlexInt `json:"guest-rx_frags"` GuestRxPackets FlexInt `json:"guest-rx_packets"` GuestTxBytes FlexInt `json:"guest-tx_bytes"` GuestTxDropped FlexInt `json:"guest-tx_dropped"` GuestTxErrors FlexInt `json:"guest-tx_errors"` GuestTxPackets FlexInt `json:"guest-tx_packets"` GuestTxRetries FlexInt `json:"guest-tx_retries"` GuestWifiTxAttempts FlexInt `json:"guest-wifi_tx_attempts"` GuestWifiTxDropped FlexInt `json:"guest-wifi_tx_dropped"` MacFilterRejections FlexInt `json:"mac_filter_rejections"` O string `json:"o"` Oid string `json:"oid"` RxBytes FlexInt `json:"rx_bytes"` RxCrypts FlexInt `json:"rx_crypts"` RxDropped FlexInt `json:"rx_dropped"` RxErrors FlexInt `json:"rx_errors"` RxFrags FlexInt `json:"rx_frags"` RxPackets FlexInt `json:"rx_packets"` SiteID string `fake:"{uuid}" json:"site_id"` Time FlexInt `json:"time"` TxBytes FlexInt `json:"tx_bytes"` TxDropped FlexInt `json:"tx_dropped"` TxErrors FlexInt `json:"tx_errors"` TxPackets FlexInt `json:"tx_packets"` TxRetries FlexInt `json:"tx_retries"` UserMacFilterRejections FlexInt `json:"user-mac_filter_rejections"` UserRxBytes FlexInt `json:"user-rx_bytes"` UserRxCrypts FlexInt `json:"user-rx_crypts"` UserRxDropped FlexInt `json:"user-rx_dropped"` UserRxErrors FlexInt `json:"user-rx_errors"` UserRxFrags FlexInt `json:"user-rx_frags"` UserRxPackets FlexInt `json:"user-rx_packets"` UserTxBytes FlexInt `json:"user-tx_bytes"` UserTxDropped FlexInt `json:"user-tx_dropped"` UserTxErrors FlexInt `json:"user-tx_errors"` UserTxPackets FlexInt `json:"user-tx_packets"` UserTxRetries FlexInt `json:"user-tx_retries"` UserWifiTxAttempts FlexInt `json:"user-wifi_tx_attempts"` UserWifiTxDropped FlexInt `json:"user-wifi_tx_dropped"` WifiTxAttempts FlexInt `json:"wifi_tx_attempts"` WifiTxDropped FlexInt `json:"wifi_tx_dropped"` }
Ap is a subtype of UAPStat to make unmarshalling of different controller versions possible.
type Camera ¶
type Camera struct { IsDeleting bool `json:"isDeleting"` Mac string `json:"mac"` Host string `json:"host"` ConnectionHost any `json:"connectionHost"` Type string `json:"type"` Sysid any `json:"sysid"` Name string `json:"name"` UpSince any `json:"upSince"` Uptime any `json:"uptime"` LastSeen int64 `json:"lastSeen"` ConnectedSince any `json:"connectedSince"` State string `json:"state"` LastDisconnect any `json:"lastDisconnect"` HardwareRevision any `json:"hardwareRevision"` FirmwareVersion any `json:"firmwareVersion"` LatestFirmwareVersion any `json:"latestFirmwareVersion"` FirmwareBuild any `json:"firmwareBuild"` IsUpdating bool `json:"isUpdating"` IsDownloadingFW bool `json:"isDownloadingFW"` FwUpdateState string `json:"fwUpdateState"` IsAdopting bool `json:"isAdopting"` IsRestoring bool `json:"isRestoring"` IsAdopted bool `json:"isAdopted"` IsAdoptedByOther bool `json:"isAdoptedByOther"` IsProvisioned bool `json:"isProvisioned"` IsRebooting bool `json:"isRebooting"` IsSSHEnabled bool `json:"isSshEnabled"` CanAdopt bool `json:"canAdopt"` IsAttemptingToConnect bool `json:"isAttemptingToConnect"` UplinkDevice any `json:"uplinkDevice"` GUID any `json:"guid"` AnonymousDeviceID any `json:"anonymousDeviceId"` LastMotion any `json:"lastMotion"` MicVolume int `json:"micVolume"` IsMicEnabled bool `json:"isMicEnabled"` IsRecording bool `json:"isRecording"` IsWirelessUplinkEnabled bool `json:"isWirelessUplinkEnabled"` IsMotionDetected bool `json:"isMotionDetected"` IsSmartDetected bool `json:"isSmartDetected"` PhyRate any `json:"phyRate"` HdrMode bool `json:"hdrMode"` VideoMode string `json:"videoMode"` IsProbingForWifi bool `json:"isProbingForWifi"` ApMac any `json:"apMac"` ApRssi any `json:"apRssi"` ApMgmtIP any `json:"apMgmtIp"` ElementInfo any `json:"elementInfo"` ChimeDuration int `json:"chimeDuration"` IsDark bool `json:"isDark"` LastPrivacyZonePositionID any `json:"lastPrivacyZonePositionId"` LastRing any `json:"lastRing"` IsLiveHeatmapEnabled bool `json:"isLiveHeatmapEnabled"` EventStats struct { Motion struct { Today int `json:"today"` Average int `json:"average"` LastDays []int `json:"lastDays"` RecentHours []int `json:"recentHours"` } `json:"motion"` Smart struct { Today int `json:"today"` Average int `json:"average"` LastDays []int `json:"lastDays"` } `json:"smart"` } `json:"eventStats"` VideoReconfigurationInProgress bool `json:"videoReconfigurationInProgress"` Voltage any `json:"voltage"` ActivePatrolSlot any `json:"activePatrolSlot"` UseGlobal bool `json:"useGlobal"` HubMac any `json:"hubMac"` IsPoorNetwork bool `json:"isPoorNetwork"` StopStreamLevel any `json:"stopStreamLevel"` DownScaleMode int `json:"downScaleMode"` IsExtenderInstalledEver bool `json:"isExtenderInstalledEver"` IsWaterproofCaseAttached bool `json:"isWaterproofCaseAttached"` UserConfiguredAp bool `json:"userConfiguredAp"` HasRecordings bool `json:"hasRecordings"` VideoCodec string `json:"videoCodec"` VideoCodecState int `json:"videoCodecState"` VideoCodecSwitchingSince any `json:"videoCodecSwitchingSince"` EnableNfc bool `json:"enableNfc"` IsThirdPartyCamera bool `json:"isThirdPartyCamera"` StreamingChannels []int `json:"streamingChannels"` WiredConnectionState struct { PhyRate any `json:"phyRate"` } `json:"wiredConnectionState"` WifiConnectionState struct { Channel any `json:"channel"` Frequency any `json:"frequency"` PhyRate any `json:"phyRate"` TxRate any `json:"txRate"` SignalQuality any `json:"signalQuality"` Ssid any `json:"ssid"` Bssid any `json:"bssid"` ApName any `json:"apName"` Experience any `json:"experience"` SignalStrength any `json:"signalStrength"` Connectivity any `json:"connectivity"` } `json:"wifiConnectionState"` Channels []struct { ID int `json:"id"` VideoID string `json:"videoId"` Name string `json:"name"` Enabled bool `json:"enabled"` IsRtspEnabled bool `json:"isRtspEnabled"` RtspAlias string `json:"rtspAlias"` Width int `json:"width"` Height int `json:"height"` Fps int `json:"fps"` Bitrate int64 `json:"bitrate"` MinBitrate any `json:"minBitrate"` MaxBitrate any `json:"maxBitrate"` MinClientAdaptiveBitRate any `json:"minClientAdaptiveBitRate"` MinMotionAdaptiveBitRate any `json:"minMotionAdaptiveBitRate"` FpsValues []int `json:"fpsValues"` IdrInterval int `json:"idrInterval"` AutoFps bool `json:"autoFps"` AutoBitrate bool `json:"autoBitrate"` } `json:"channels"` IspSettings struct { AeMode string `json:"aeMode"` IrLedMode string `json:"irLedMode"` IrLedLevel int `json:"irLedLevel"` Wdr int `json:"wdr"` IcrSensitivity int `json:"icrSensitivity"` IcrSwitchMode string `json:"icrSwitchMode"` IcrCustomValue int `json:"icrCustomValue"` Brightness int `json:"brightness"` Contrast int `json:"contrast"` Hue int `json:"hue"` Saturation int `json:"saturation"` Sharpness int `json:"sharpness"` Denoise int `json:"denoise"` IsColorNightVisionEnabled bool `json:"isColorNightVisionEnabled"` SpotlightDuration int `json:"spotlightDuration"` IsFlippedVertical bool `json:"isFlippedVertical"` IsFlippedHorizontal bool `json:"isFlippedHorizontal"` IsAutoRotateEnabled bool `json:"isAutoRotateEnabled"` IsLdcEnabled bool `json:"isLdcEnabled"` Is3DnrEnabled bool `json:"is3dnrEnabled"` IsExternalIrEnabled bool `json:"isExternalIrEnabled"` IsAggressiveAntiFlickerEnabled bool `json:"isAggressiveAntiFlickerEnabled"` IsPauseMotionEnabled bool `json:"isPauseMotionEnabled"` DZoomCenterX int `json:"dZoomCenterX"` DZoomCenterY int `json:"dZoomCenterY"` DZoomScale int `json:"dZoomScale"` DZoomStreamID int `json:"dZoomStreamId"` FocusPosition int `json:"focusPosition"` TouchFocusX any `json:"touchFocusX"` TouchFocusY any `json:"touchFocusY"` ZoomPosition int `json:"zoomPosition"` MountPosition any `json:"mountPosition"` HdrMode string `json:"hdrMode"` } `json:"ispSettings"` AudioSettings struct { Style []string `json:"style"` } `json:"audioSettings"` TalkbackSettings struct { TypeFmt string `json:"typeFmt"` TypeIn string `json:"typeIn"` BindAddr string `json:"bindAddr"` BindPort int `json:"bindPort"` FilterAddr any `json:"filterAddr"` FilterPort any `json:"filterPort"` Channels int `json:"channels"` SamplingRate int `json:"samplingRate"` BitsPerSample int `json:"bitsPerSample"` Quality int `json:"quality"` } `json:"talkbackSettings"` OsdSettings struct { IsNameEnabled bool `json:"isNameEnabled"` IsDateEnabled bool `json:"isDateEnabled"` IsLogoEnabled bool `json:"isLogoEnabled"` IsDebugEnabled bool `json:"isDebugEnabled"` } `json:"osdSettings"` LedSettings struct { IsEnabled bool `json:"isEnabled"` BlinkRate int `json:"blinkRate"` } `json:"ledSettings"` SpeakerSettings struct { IsEnabled bool `json:"isEnabled"` AreSystemSoundsEnabled bool `json:"areSystemSoundsEnabled"` Volume int `json:"volume"` } `json:"speakerSettings"` RecordingSettings struct { PrePaddingSecs int `json:"prePaddingSecs"` PostPaddingSecs int `json:"postPaddingSecs"` SmartDetectPrePaddingSecs int `json:"smartDetectPrePaddingSecs"` SmartDetectPostPaddingSecs int `json:"smartDetectPostPaddingSecs"` MinMotionEventTrigger int `json:"minMotionEventTrigger"` EndMotionEventDelay int `json:"endMotionEventDelay"` SuppressIlluminationSurge bool `json:"suppressIlluminationSurge"` Mode string `json:"mode"` InScheduleMode string `json:"inScheduleMode"` OutScheduleMode string `json:"outScheduleMode"` Geofencing string `json:"geofencing"` MotionAlgorithm string `json:"motionAlgorithm"` EnableMotionDetection bool `json:"enableMotionDetection"` UseNewMotionAlgorithm bool `json:"useNewMotionAlgorithm"` } `json:"recordingSettings"` SmartDetectSettings struct { ObjectTypes []any `json:"objectTypes"` AutoTrackingObjectTypes []any `json:"autoTrackingObjectTypes"` AudioTypes []any `json:"audioTypes"` DetectionRange struct { Max any `json:"max"` Min any `json:"min"` } `json:"detectionRange"` } `json:"smartDetectSettings"` RecordingSchedulesV2 []any `json:"recordingSchedulesV2"` MotionZones []any `json:"motionZones"` PrivacyZones []any `json:"privacyZones"` SmartDetectZones []any `json:"smartDetectZones"` SmartDetectLines []any `json:"smartDetectLines"` Stats struct { RxBytes int `json:"rxBytes"` TxBytes int `json:"txBytes"` Wifi struct { Channel any `json:"channel"` Frequency any `json:"frequency"` LinkSpeedMbps any `json:"linkSpeedMbps"` SignalQuality int `json:"signalQuality"` SignalStrength int `json:"signalStrength"` } `json:"wifi"` Video struct { RecordingStart int64 `json:"recordingStart"` RecordingEnd int64 `json:"recordingEnd"` RecordingStartLQ any `json:"recordingStartLQ"` RecordingEndLQ any `json:"recordingEndLQ"` TimelapseStart any `json:"timelapseStart"` TimelapseEnd any `json:"timelapseEnd"` TimelapseStartLQ any `json:"timelapseStartLQ"` TimelapseEndLQ any `json:"timelapseEndLQ"` } `json:"video"` Storage struct { Used any `json:"used"` Rate any `json:"rate"` ChannelStorage struct { Num0 struct { Rotating struct { RecordingsSizeBytes int64 `json:"recordingsSizeBytes"` LockedRecordingsSizeBytes int `json:"lockedRecordingsSizeBytes"` } `json:"rotating"` Timelapse struct { RecordingsSizeBytes int `json:"recordingsSizeBytes"` LockedRecordingsSizeBytes int `json:"lockedRecordingsSizeBytes"` } `json:"timelapse"` } `json:"0"` } `json:"channelStorage"` } `json:"storage"` WifiQuality int `json:"wifiQuality"` WifiStrength int `json:"wifiStrength"` } `json:"stats"` FeatureFlags struct { CanAdjustIrLedLevel bool `json:"canAdjustIrLedLevel"` CanMagicZoom bool `json:"canMagicZoom"` CanOpticalZoom bool `json:"canOpticalZoom"` CanTouchFocus bool `json:"canTouchFocus"` HasAccelerometer bool `json:"hasAccelerometer"` HasVerticalFlip bool `json:"hasVerticalFlip"` HasAec bool `json:"hasAec"` HasBluetooth bool `json:"hasBluetooth"` HasChime bool `json:"hasChime"` HasExternalIr bool `json:"hasExternalIr"` HasIcrSensitivity bool `json:"hasIcrSensitivity"` HasInfrared bool `json:"hasInfrared"` HasLdc bool `json:"hasLdc"` HasLedIr bool `json:"hasLedIr"` HasLedStatus bool `json:"hasLedStatus"` HasLineIn bool `json:"hasLineIn"` HasMic bool `json:"hasMic"` HasPrivacyMask bool `json:"hasPrivacyMask"` HasRtc bool `json:"hasRtc"` HasSdCard bool `json:"hasSdCard"` HasSpeaker bool `json:"hasSpeaker"` HasWifi bool `json:"hasWifi"` HasHdr bool `json:"hasHdr"` HasAutoICROnly bool `json:"hasAutoICROnly"` VideoModes []any `json:"videoModes"` VideoModeMaxFps []any `json:"videoModeMaxFps"` HasMotionZones bool `json:"hasMotionZones"` HasLcdScreen bool `json:"hasLcdScreen"` MountPositions []any `json:"mountPositions"` SmartDetectTypes []any `json:"smartDetectTypes"` SmartDetectAudioTypes []any `json:"smartDetectAudioTypes"` SupportDoorAccessConfig bool `json:"supportDoorAccessConfig"` SupportNfc bool `json:"supportNfc"` LensType any `json:"lensType"` LensModel any `json:"lensModel"` MotionAlgorithms []any `json:"motionAlgorithms"` HasSquareEventThumbnail bool `json:"hasSquareEventThumbnail"` HasPackageCamera bool `json:"hasPackageCamera"` Audio []any `json:"audio"` AudioCodecs []any `json:"audioCodecs"` VideoCodecs []any `json:"videoCodecs"` AudioStyle []any `json:"audioStyle"` IsDoorbell bool `json:"isDoorbell"` IsPtz bool `json:"isPtz"` HasColorLcdScreen bool `json:"hasColorLcdScreen"` HasLiveviewTracking bool `json:"hasLiveviewTracking"` HasLineCrossing bool `json:"hasLineCrossing"` HasLineCrossingCounting bool `json:"hasLineCrossingCounting"` HasFlash bool `json:"hasFlash"` FlashRange any `json:"flashRange"` HasLuxCheck bool `json:"hasLuxCheck"` PresetTour bool `json:"presetTour"` PrivacyMaskCapability struct { MaxMasks any `json:"maxMasks"` RectangleOnly bool `json:"rectangleOnly"` } `json:"privacyMaskCapability"` Focus struct { Steps struct { Max any `json:"max"` Min any `json:"min"` Step any `json:"step"` } `json:"steps"` Degrees struct { Max any `json:"max"` Min any `json:"min"` Step any `json:"step"` } `json:"degrees"` } `json:"focus"` Pan struct { Steps struct { Max any `json:"max"` Min any `json:"min"` Step any `json:"step"` } `json:"steps"` Degrees struct { Max any `json:"max"` Min any `json:"min"` Step any `json:"step"` } `json:"degrees"` } `json:"pan"` Tilt struct { Steps struct { Max any `json:"max"` Min any `json:"min"` Step any `json:"step"` } `json:"steps"` Degrees struct { Max any `json:"max"` Min any `json:"min"` Step any `json:"step"` } `json:"degrees"` } `json:"tilt"` Zoom struct { Ratio int `json:"ratio"` Steps struct { Max any `json:"max"` Min any `json:"min"` Step any `json:"step"` } `json:"steps"` Degrees struct { Max any `json:"max"` Min any `json:"min"` Step any `json:"step"` } `json:"degrees"` } `json:"zoom"` Hotplug struct { Audio any `json:"audio"` Video any `json:"video"` StandaloneAdoption bool `json:"standaloneAdoption"` Extender struct { IsAttached any `json:"isAttached"` HasFlash any `json:"hasFlash"` FlashRange any `json:"flashRange"` HasIR any `json:"hasIR"` HasRadar any `json:"hasRadar"` RadarRangeMax any `json:"radarRangeMax"` RadarRangeMin any `json:"radarRangeMin"` } `json:"extender"` } `json:"hotplug"` HasSmartDetect bool `json:"hasSmartDetect"` } `json:"featureFlags"` TiltLimitsOfPrivacyZones struct { Side string `json:"side"` Limit int `json:"limit"` } `json:"tiltLimitsOfPrivacyZones"` LcdMessage struct { } `json:"lcdMessage"` Lenses []any `json:"lenses"` StreamSharing struct { Enabled bool `json:"enabled"` Token any `json:"token"` ShareLink any `json:"shareLink"` Expires any `json:"expires"` SharedByUserID any `json:"sharedByUserId"` SharedByUser any `json:"sharedByUser"` MaxStreams any `json:"maxStreams"` } `json:"streamSharing"` HomekitSettings struct { TalkbackSettingsActive bool `json:"talkbackSettingsActive"` StreamInProgress bool `json:"streamInProgress"` MicrophoneMuted bool `json:"microphoneMuted"` SpeakerMuted bool `json:"speakerMuted"` } `json:"homekitSettings"` Shortcuts []any `json:"shortcuts"` Alarms struct { LensThermal int `json:"lensThermal"` TiltThermal int `json:"tiltThermal"` PanTiltMotorFaults []any `json:"panTiltMotorFaults"` AutoTrackingThermalThresholdReached bool `json:"autoTrackingThermalThresholdReached"` LensThermalThresholdReached bool `json:"lensThermalThresholdReached"` MotorOverheated bool `json:"motorOverheated"` } `json:"alarms"` ExtendedAiFeatures struct { SmartDetectTypes []any `json:"smartDetectTypes"` } `json:"extendedAiFeatures"` ThirdPartyCameraInfo struct { Port FlexInt `json:"port"` RtspURL string `json:"rtspUrl"` RtspURLLQ any `json:"rtspUrlLQ"` SnapshotURL string `json:"snapshotUrl"` } `json:"thirdPartyCameraInfo"` ID string `json:"id"` NvrMac string `json:"nvrMac"` DisplayName string `json:"displayName"` IsConnected bool `json:"isConnected"` Platform any `json:"platform"` HasSpeaker bool `json:"hasSpeaker"` HasWifi bool `json:"hasWifi"` AudioBitrate int `json:"audioBitrate"` CanManage bool `json:"canManage"` IsManaged bool `json:"isManaged"` MarketName string `json:"marketName"` Is4K bool `json:"is4K"` Is2K bool `json:"is2K"` CurrentResolution string `json:"currentResolution"` SupportedScalingResolutions []string `json:"supportedScalingResolutions"` ModelKey string `json:"modelKey"` }
type Client ¶
type Client struct { Anomalies FlexInt `json:"anomalies,omitempty"` ApMac string `fake:"{macaddress}" json:"ap_mac"` ApName string `json:"-"` AssocTime FlexInt `json:"assoc_time"` Blocked bool `json:"blocked,omitempty"` Bssid string `fake:"{macaddress}" json:"bssid"` BytesR FlexInt `json:"bytes-r"` Ccq FlexInt `json:"ccq"` Channel FlexInt `json:"channel"` DevCat FlexInt `json:"dev_cat"` DevFamily FlexInt `json:"dev_family"` DevID FlexInt `json:"dev_id"` DevVendor FlexInt `json:"dev_vendor,omitempty"` DhcpendTime FlexInt `json:"dhcpend_time,omitempty"` Essid string `fake:"{macaddress}" json:"essid"` FirstSeen FlexInt `json:"first_seen"` FixedIP string `fake:"{ipv4address}" json:"fixed_ip"` GwMac string `fake:"{macaddress}" json:"gw_mac"` GwName string `json:"-"` Hostname string `json:"hostname"` ID string `fake:"{uuid}" json:"_id"` IP string `fake:"{ipv4address}" json:"ip"` IdleTime FlexInt `json:"idle_time"` Is11R FlexBool `json:"is_11r"` IsGuest FlexBool `json:"is_guest"` IsGuestByUAP FlexBool `json:"_is_guest_by_uap"` IsGuestByUGW FlexBool `json:"_is_guest_by_ugw"` IsGuestByUSW FlexBool `json:"_is_guest_by_usw"` IsWired FlexBool `json:"is_wired"` LastSeen FlexInt `json:"last_seen"` LastSeenByUAP FlexInt `json:"_last_seen_by_uap"` LastSeenByUGW FlexInt `json:"_last_seen_by_ugw"` LastSeenByUSW FlexInt `json:"_last_seen_by_usw"` LatestAssocTime FlexInt `json:"latest_assoc_time"` Mac string `fake:"{macaddress}" json:"mac"` Name string `fake:"{randomstring:[client-1,client-2,client-3]}" json:"name"` Network string `json:"network"` NetworkID string `fake:"{uuid}" json:"network_id"` Noise FlexInt `json:"noise"` Note string `fake:"{sentence 20}" json:"note"` Noted FlexBool `json:"noted"` OsClass FlexInt `json:"os_class"` OsName FlexInt `json:"os_name"` Oui string `json:"oui"` PowersaveEnabled FlexBool `json:"powersave_enabled"` QosPolicyApplied FlexBool `json:"qos_policy_applied"` Radio string `json:"radio"` RadioDescription string `json:"-"` RadioName string `json:"radio_name"` RadioProto string `json:"radio_proto"` RoamCount FlexInt `json:"roam_count"` Rssi FlexInt `json:"rssi"` RxBytes FlexInt `json:"rx_bytes"` RxBytesR FlexInt `json:"rx_bytes-r"` RxPackets FlexInt `json:"rx_packets"` RxRate FlexInt `json:"rx_rate"` Satisfaction FlexInt `json:"satisfaction,omitempty"` Signal FlexInt `json:"signal"` SiteID string `fake:"{uuid}" json:"site_id"` SiteName string `json:"-"` SourceName string `json:"-"` SwDepth int `json:"sw_depth"` SwMac string `fake:"{macaddress}" json:"sw_mac"` SwName string `json:"-"` SwPort FlexInt `json:"sw_port"` TxBytes FlexInt `json:"tx_bytes"` TxBytesR FlexInt `json:"tx_bytes-r"` TxPackets FlexInt `json:"tx_packets"` TxPower FlexInt `json:"tx_power"` TxRate FlexInt `json:"tx_rate"` TxRetries FlexInt `json:"tx_retries"` Uptime FlexInt `json:"uptime"` UptimeByUAP FlexInt `json:"_uptime_by_uap"` UptimeByUGW FlexInt `json:"_uptime_by_ugw"` UptimeByUSW FlexInt `json:"_uptime_by_usw"` UseFixedIP FlexBool `json:"use_fixedip"` UserGroupID string `fake:"{uuid}" json:"usergroup_id"` UserID string `fake:"{uuid}" json:"user_id"` Vlan FlexInt `json:"vlan"` WifiTxAttempts FlexInt `json:"wifi_tx_attempts"` WiredRxBytes FlexInt `json:"wired-rx_bytes"` WiredRxBytesR FlexInt `json:"wired-rx_bytes-r"` WiredRxPackets FlexInt `json:"wired-rx_packets"` WiredTxBytes FlexInt `json:"wired-tx_bytes"` WiredTxBytesR FlexInt `json:"wired-tx_bytes-r"` WiredTxPackets FlexInt `json:"wired-tx_packets"` }
Client defines all the data a connected-network client contains.
type Config ¶
type Config struct { User string Pass string URL string SSLCert [][]byte ErrorLog Logger DebugLog Logger Timeout time.Duration // how long to wait for replies, default: forever. VerifySSL bool }
Config is the data passed into our library. This configures things and allows us to connect to a controller and write log messages. Optional SSLCert is used for ssl cert pinning; provide the content of a PEM to validate the server's cert.
type ConfigNetwork ¶
type ConfigNetwork struct { Type string `fake:"{randomstring:[wan,lan,vlan]}" json:"type"` IP string `fake:"{ipv4address}" json:"ip"` }
ConfigNetwork comes from gateways.
type ConfigNetworkLan ¶
ConfigNetworkLan is part of a UXG, maybe others.
type DPIClient ¶
type DPIClient struct { Mac string `fake:"{macaddress}" json:"mac"` RxBytes FlexInt `json:"rx_bytes"` RxPackets FlexInt `json:"rx_packets"` TxBytes FlexInt `json:"tx_bytes"` TxPackets FlexInt `json:"tx_packets"` }
DPIClient data is sometimes included in ByApp output.
type DPIData ¶
type DPIData struct { App FlexInt `json:"app"` Cat FlexInt `json:"cat"` Clients []*DPIClient `fakesize:"5" json:"clients,omitempty"` KnownClients FlexInt `json:"known_clients,omitempty"` RxBytes FlexInt `json:"rx_bytes"` RxPackets FlexInt `json:"rx_packets"` TxBytes FlexInt `json:"tx_bytes"` TxPackets FlexInt `json:"tx_packets"` }
DPIData is the DPI data in the DPI table.
type DPIMap ¶
DPIMap allows binding methods to the DPICat and DPIApps variables.
type DPITable ¶
type DPITable struct { ByApp []DPIData `fakesize:"5" json:"by_app"` ByCat []DPIData `fakesize:"5" json:"by_cat"` LastUpdated FlexInt `json:"last_updated"` MAC string `fake:"{macaddress}" json:"mac"` Name string `json:"-"` SiteName string `json:"-"` SourceName string `json:"-"` }
DPITable contains DPI data for clients or sites, or .. things.
type Devices ¶
type Devices struct { UAPs []*UAP `fakesize:"5"` USGs []*USG `fakesize:"5"` USWs []*USW `fakesize:"5"` UDMs []*UDM `fakesize:"5"` UXGs []*UXG `fakesize:"5"` PDUs []*PDU `fakesize:"5"` }
Devices contains a list of all the unifi devices from a controller. Contains Access points, security gateways and switches.
type DownlinkTable ¶
type DownlinkTable struct { PortIdx FlexInt `json:"port_idx"` Speed FlexInt `json:"speed"` FullDuplex FlexBool `json:"full_duplex"` Mac string `fake:"{macaddress}" json:"mac"` }
DownlinkTable is part of a UXG and UDM output.
type EthernetOverrides ¶
type EthernetTable ¶
type Event ¶
type Event struct { Admin string `json:"admin"` Ap string `json:"ap"` ApFrom string `json:"ap_from"` ApName string `json:"ap_name"` ApTo string `json:"ap_to"` AppProto string `json:"app_proto"` Bytes FlexInt `json:"bytes"` Catname FlexString `json:"catname"` Channel FlexInt `json:"channel"` ChannelFrom FlexInt `json:"channel_from"` ChannelTo FlexInt `json:"channel_to"` Datetime time.Time `fake:"{recent_time}" json:"datetime"` DestIP string `fake:"{ipv4address}" json:"dest_ip"` DestIPGeo IPGeo `json:"dstipGeo"` DestPort int `fake:"{port}" json:"dest_port"` DstMAC string `fake:"{macaddress}" json:"dst_mac"` Duration FlexInt `json:"duration"` EventType string `json:"event_type"` FlowID FlexInt `json:"flow_id"` Guest string `json:"guest"` Gw string `json:"gw"` GwName string `json:"gw_name"` Host string `json:"host"` Hostname string `json:"hostname"` ID string `fake:"{uuid}" json:"_id"` IP string `fake:"{ipv4address}" json:"ip"` InIface string `json:"in_iface"` InnerAlertAction string `json:"inner_alert_action"` InnerAlertCategory string `json:"inner_alert_category"` InnerAlertGID FlexInt `json:"inner_alert_gid"` InnerAlertRev FlexInt `json:"inner_alert_rev"` InnerAlertSeverity FlexInt `json:"inner_alert_severity"` InnerAlertSignature string `json:"inner_alert_signature"` InnerAlertSignatureID FlexInt `json:"inner_alert_signature_id"` IsAdmin FlexBool `json:"is_admin"` Key string `fake:"{uuid}" json:"key"` Msg string `fake:"{buzzword}" json:"msg"` Network string `json:"network"` Proto string `json:"proto"` Radio string `json:"radio"` RadioFrom string `json:"radio_from"` RadioTo string `json:"radio_to"` SSID string `fake:"{macaddress}" json:"ssid"` SiteID string `fake:"{}" json:"site_id"` SiteName string `json:"-"` SourceIPGeo IPGeo `json:"srcipGeo"` SourceName string `json:"-"` SrcIP string `fake:"{ipv4address}" json:"src_ip"` SrcIPASN string `fake:"{address}" json:"srcipASN"` SrcIPCountry string `fake:"{country}" json:"srcipCountry"` SrcMAC string `fake:"{macaddress}" json:"src_mac"` SrcPort int `fake:"{port}" json:"src_port"` Subsystem string `json:"subsystem"` Sw string `json:"sw"` SwName string `json:"sw_name"` Time int64 `fake:"{timestamp}" json:"time"` Timestamp int64 `fake:"{timestamp}" json:"timestamp"` USGIP string `fake:"{ipv4address}" json:"usgip"` USGIPASN string `fake:"{address}" json:"usgipASN"` USGIPCountry string `fake:"{country}" json:"usgipCountry"` USGIPGeo IPGeo `json:"usgipGeo"` UniqueAlertID string `json:"unique_alertid"` User string `json:"user"` }
Event describes a UniFi Event. API Path: /api/s/default/stat/event.
type FlexBool ¶
FlexBool provides a container and unmarshalling for fields that may be boolean or strings in the Unifi API.
func NewFlexBool ¶
func (FlexBool) Fake ¶
func (f FlexBool) Fake(faker *gofakeit.Faker) interface{}
Fake implements gofakeit Fake interface
func (FlexBool) MarshalJSON ¶
func (*FlexBool) UnmarshalJSON ¶
UnmarshalJSON method converts armed/disarmed, yes/no, active/inactive or 0/1 to true/false. Really it converts ready, ok, 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 NewFlexInt ¶
func (*FlexInt) AddFloat64 ¶
func (FlexInt) Fake ¶
func (f FlexInt) Fake(faker *gofakeit.Faker) interface{}
Fake implements gofakeit Fake interface
func (FlexInt) MarshalJSON ¶
func (*FlexInt) UnmarshalJSON ¶
UnmarshalJSON converts a string or number to an integer. Generally, do not call this directly, it's used in the json interface.
type FlexString ¶
func NewFlexString ¶
func NewFlexString(v string) *FlexString
func NewFlexStringArray ¶
func NewFlexStringArray(v []string) *FlexString
func (FlexString) Fake ¶
func (f FlexString) Fake(faker *gofakeit.Faker) interface{}
func (FlexString) MarshalJSON ¶
func (f FlexString) MarshalJSON() ([]byte, error)
func (FlexString) String ¶
func (f FlexString) String() string
func (*FlexString) UnmarshalJSON ¶
func (f *FlexString) UnmarshalJSON(b []byte) error
UnmarshalJSON converts a string or number to an integer. Generally, do not call this directly, it's used in the json interface.
type FlexTemp ¶
FlexTemp provides a container and unmarshalling for fields that may be numbers or strings in the Unifi API as temperatures.
func NewFlexTemp ¶
func (*FlexTemp) AddFloat64 ¶
func (*FlexTemp) CelsiusInt ¶
func (*FlexTemp) CelsiusInt64 ¶
func (*FlexTemp) Fahrenheit ¶
func (*FlexTemp) FahrenheitInt ¶
func (*FlexTemp) FahrenheitInt64 ¶
func (FlexTemp) Fake ¶
func (f FlexTemp) Fake(faker *gofakeit.Faker) interface{}
Fake implements gofakeit Fake interface
func (FlexTemp) MarshalJSON ¶
func (*FlexTemp) UnmarshalJSON ¶
UnmarshalJSON converts a string or number to an integer. Generally, do not call this directly, it's used in the json interface.
type GeoInfo ¶
type GeoInfo struct { Accuracy FlexInt `json:"accuracy"` Address string `fake:"{address}" json:"address"` Asn FlexInt `json:"asn"` City string `fake:"{city}" json:"city"` ContinentCode string `json:"continent_code"` CountryCode string `json:"country_code"` CountryName string `fake:"{country}" json:"country_name"` IspName string `json:"isp_name"` IspOrganization string `json:"isp_organization"` Latitude FlexInt `json:"latitude"` Longitude FlexInt `json:"longitude"` Timezone string `json:"timezone"` }
GeoInfo is incuded with certain devices.
type Gw ¶
type Gw struct { Datetime time.Time `fake:"{recent_time}" json:"datetime"` Duration FlexInt `json:"duration"` Gw string `json:"gw"` LanRxBytes FlexInt `json:"lan-rx_bytes"` LanRxDropped FlexInt `json:"lan-rx_dropped"` LanRxErrors FlexInt `json:"lan-rx_errors,omitempty"` LanRxPackets FlexInt `json:"lan-rx_packets"` LanTxBytes FlexInt `json:"lan-tx_bytes"` LanTxPackets FlexInt `json:"lan-tx_packets"` O string `json:"o"` Oid string `json:"oid"` SiteID string `json:"site_id"` Time FlexInt `json:"time"` WanRxBytes FlexInt `json:"wan-rx_bytes"` WanRxDropped FlexInt `json:"wan-rx_dropped"` WanRxErrors FlexInt `json:"wan-rx_errors,omitempty"` WanRxPackets FlexInt `json:"wan-rx_packets"` WanTxBytes FlexInt `json:"wan-tx_bytes"` WanTxPackets FlexInt `json:"wan-tx_packets"` }
Gw is a subtype of USGStat to make unmarshalling of different controller versions possible.
type IDS ¶
type IDS struct { AppProto string `json:"app_proto,omitempty"` Archived FlexBool `json:"archived"` Catname FlexString `json:"catname"` Datetime time.Time `fake:"{recent_time}" json:"datetime"` DestIP string `fake:"{ipv4address}" json:"dest_ip"` DestIPGeo IPGeo `json:"dstipGeo"` DestPort int `fake:"{port}" json:"dest_port,omitempty"` DstIPASN string `fake:"{address}" json:"dstipASN"` DstIPCountry string `fake:"{country}" json:"dstipCountry"` DstMAC string `fake:"{macaddress}" json:"dst_mac"` EventType string `json:"event_type"` FlowID int64 `json:"flow_id"` Host string `json:"host"` ID string `fake:"{uuid}" json:"_id"` InIface string `json:"in_iface"` InnerAlertAction string `json:"inner_alert_action"` InnerAlertCategory string `json:"inner_alert_category"` InnerAlertGID int64 `json:"inner_alert_gid"` InnerAlertRev int64 `json:"inner_alert_rev"` InnerAlertSeverity int64 `json:"inner_alert_severity"` InnerAlertSignature string `json:"inner_alert_signature"` InnerAlertSignatureID int64 `json:"inner_alert_signature_id"` Key string `fake:"{uuid}" json:"key"` Msg string `fake:"{buzzword}" json:"msg"` Proto string `json:"proto"` SiteID string `fake:"{uuid}" json:"site_id"` SiteName string `json:"-"` SourceIPGeo IPGeo `json:"srcipGeo"` SourceName string `json:"-"` SrcIP string `fake:"{ipv4address}" json:"src_ip"` SrcIPASN string `fake:"{address}" json:"srcipASN"` SrcIPCountry string `fake:"{country}" json:"srcipCountry"` SrcMAC string `fake:"{macaddress}" json:"src_mac"` SrcPort int `fake:"{port}" json:"src_port,omitempty"` Subsystem string `json:"subsystem"` Time int64 `fake:"{timestamp}" json:"time"` Timestamp int64 `fake:"{timestamp}" json:"timestamp"` USGIP string `fake:"{ipv4address}" json:"usgip"` USGIPASN string `fake:"{address}" json:"usgipASN"` USGIPCountry string `fake:"{country}" json:"usgipCountry"` USGIPGeo IPGeo `json:"usgipGeo"` UniqueAlertID string `json:"unique_alertid"` }
IDS holds an Intrusion Prevention System Event. nolint: revive // actual IDS
type IPGeo ¶
type IPGeo struct { Asn int64 `json:"asn"` City string `fake:"{city}" json:"city"` ContinentCode string `json:"continent_code"` CountryCode string `fake:"{countryabr}" json:"country_code"` CountryName string `fake:"{country}" json:"country_name"` Latitude float64 `fake:"{latitude}" json:"latitude"` Longitude float64 `fake:"{longitude}" json:"longitude"` Organization string `fake:"{company}" json:"organization"` }
IPGeo is part of the UniFi Event data. Each event may have up to three of these. One for source, one for dest and one for the USG location.
func (*IPGeo) UnmarshalJSON ¶
UnmarshalJSON is required because sometimes the unifi api returns an empty array instead of a struct filled with data.
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 MacTable ¶
type MacTable struct { Age int64 `json:"age"` Authorized FlexBool `json:"authorized"` Hostname string `json:"hostname"` IP string `json:"ip"` LastReachable int64 `json:"lastReachable"` Mac string `json:"mac"` }
MacTable is a newer feature on some switched ports.
type Network ¶
type Network struct { DhcpGuardEnabled FlexBool `json:"dhcpguard_enabled"` DhcpRelayEnabled FlexBool `json:"dhcp_relay_enabled"` DhcpdDNSEnabled FlexBool `json:"dhcpd_dns_enabled"` DhcpdEnabled FlexBool `json:"dhcpd_enabled"` DhcpdGatewayEnabled FlexBool `json:"dhcpd_gateway_enabled"` DhcpdIP1 string `json:"dhcpd_ip_1"` DhcpdLeasetime FlexInt `json:"dhcpd_leasetime"` DhcpdTimeOffsetEnabled FlexBool `json:"dhcpd_time_offset_enabled"` DomainName string `json:"domain_name"` Enabled FlexBool `json:"enabled"` ID string `fake:"{uuid}" json:"_id"` IPSubnet string `json:"ip_subnet"` IsNat FlexBool `json:"is_nat"` Name string `json:"name"` Networkgroup string `json:"networkgroup"` Purpose string `json:"purpose"` SiteID string `fake:"{uuid}" json:"site_id"` Vlan FlexInt `json:"vlan"` VlanEnabled FlexBool `json:"vlan_enabled"` }
Network is metadata about a network managed by a UniFi controller.
type NetworkTable ¶
type NetworkTable []struct { ActiveDhcpLeaseCount FlexInt `json:"active_dhcp_lease_count"` AttrHiddenID string `json:"attr_hidden_id"` AttrNoDelete FlexBool `json:"attr_no_delete"` AutoScaleEnabled FlexBool `json:"auto_scale_enabled"` DPIStatsTable *DPITable `json:"dpistats_table"` DhcpRelayEnabled FlexBool `json:"dhcp_relay_enabled"` DhcpdDNS1 string `json:"dhcpd_dns_1"` DhcpdDNS2 string `json:"dhcpd_dns_2"` DhcpdDNS3 string `json:"dhcpd_dns_3"` DhcpdDNS4 string `json:"dhcpd_dns_4"` DhcpdDNSEnabled FlexBool `json:"dhcpd_dns_enabled"` DhcpdEnabled FlexBool `json:"dhcpd_enabled"` DhcpdGatewayEnabled FlexBool `json:"dhcpd_gateway_enabled"` DhcpdLeasetime FlexInt `json:"dhcpd_leasetime"` DhcpdStart string `json:"dhcpd_start"` DhcpdStop string `json:"dhcpd_stop"` DhcpdTimeOffsetEnabled FlexBool `json:"dhcpd_time_offset_enabled"` Dhcpdv6Enabled FlexBool `json:"dhcpdv6_enabled"` DomainName string `json:"domain_name"` Enabled FlexBool `json:"enabled"` GatewayInterfaceName string `json:"gateway_interface_name"` ID string `fake:"{uuid}" json:"_id"` IP string `fake:"{ipv4address}" json:"ip"` IPSubnet string `json:"ip_subnet"` Ipv6InterfaceType string `json:"ipv6_interface_type"` Ipv6PdStart string `json:"ipv6_pd_start"` Ipv6PdStop string `json:"ipv6_pd_stop"` Ipv6RaEnabled FlexBool `json:"ipv6_ra_enabled"` IsGuest FlexBool `json:"is_guest"` IsNat FlexBool `json:"is_nat"` LteLanEnabled FlexBool `json:"lte_lan_enabled"` Mac string `fake:"{macaddress}" json:"mac"` Name string `fake:"{animal}" json:"name"` Networkgroup string `json:"networkgroup"` NumSta FlexInt `json:"num_sta"` Purpose string `json:"purpose"` RxBytes FlexInt `json:"rx_bytes"` RxPackets FlexInt `json:"rx_packets"` SiteID string `fake:"{uuid}" json:"site_id"` TxBytes FlexInt `json:"tx_bytes"` TxPackets FlexInt `json:"tx_packets"` Up FlexBool `json:"up"` VlanEnabled FlexBool `json:"vlan_enabled"` }
NetworkTable is the list of networks on a gateway. Not all gateways have all features.
type OutletOverride ¶
type OutletOverride struct { CycleEnabled FlexBool `json:"cycle_enabled"` Index FlexInt `json:"index"` Name string `fake:"{randomstring:[override-1,override-2]}" json:"name"` RelayState FlexBool `json:"relay_state"` }
OutletOverride hold the PDU outlet override data.
type OutletTable ¶
type OutletTable struct { CycleEnabled FlexBool `json:"cycle_enabled"` Index FlexInt `json:"index"` Name string `fake:"{randomstring:[table-1,table-2,table-3]]" json:"name"` OutletCaps FlexInt `json:"outlet_caps"` OutletCurrent FlexInt `json:"outlet_current"` OutletPower FlexInt `json:"outlet_power"` OutletPowerFactor FlexInt `json:"outlet_power_factor"` OutletVoltage FlexInt `json:"outlet_voltage"` RelayState FlexBool `json:"relay_state"` }
OutletTable hold the PDU outlet data.
type PDU ¶
type PDU struct { AdoptableWhenUpgraded FlexBool `json:"adoptable_when_upgraded"` Adopted FlexBool `json:"adopted"` AdoptIP string `fake:"{ipv4address}" json:"adopt_ip"` AdoptURL string `fake:"{url}" json:"adopt_url"` Anomalies FlexInt `json:"anomalies"` AnonID string `fake:"{uuid}" json:"anon_id"` Architecture string `json:"architecture"` BoardRev FlexInt `json:"board_rev"` Bytes FlexInt `json:"bytes"` CfgVersion string `fake:"{appversion}" json:"cfgversion"` ConfigNetwork *ConfigNetwork `json:"config_network"` ConnectedAt FlexInt `json:"connected_at"` ConnectionNetworkName string `json:"connection_network_name"` ConnectRequestIP string `fake:"{ipv4address}" json:"connect_request_ip"` ConnectRequestPort FlexInt `json:"connect_request_port"` Default FlexBool `json:"default"` DeviceID string `fake:"{uuid}" json:"device_id"` DiscoveredVia string `json:"discovered_via"` DisplayableVersion string `fake:"{appversion}" json:"displayable_version"` Dot1xPortCtrlEnabled FlexBool `json:"dot1x_portctrl_enabled"` DownlinkTable []*DownlinkTable `fakesize:"5" json:"downlink_table"` EthernetTable []*EthernetTable `fakesize:"5" json:"ethernet_table"` FlowctrlEnabled FlexBool `json:"flowctrl_enabled"` FwCaps FlexInt `json:"fw_caps"` GatewayMac string `fake:"{macaddress}" json:"gateway_mac"` GuestNumSta FlexInt `json:"guest-num_sta"` HasFan FlexBool `json:"has_fan"` HashID string `json:"hash_id"` HasTemperature FlexBool `json:"has_temperature"` HwCaps FlexInt `json:"hw_caps"` ID string `fake:"{uuid}" json:"_id"` InformIP string `fake:"{ipv4address}" json:"inform_ip"` InformURL string `fake:"{url}" json:"inform_url"` Internet FlexBool `json:"internet"` IP string `fake:"{ipv4address}" json:"ip"` JumboframeEnabled FlexBool `json:"jumboframe_enabled"` KernelVersion string `fake:"{appversion}" json:"kernel_version"` KnownCfgVersion string `fake:"{appversion}" json:"known_cfgversion"` LastSeen FlexInt `json:"last_seen"` LastUplink Uplink `json:"last_uplink"` LcmBrightness FlexInt `json:"lcm_brightness"` LcmBrightnessOverride FlexBool `json:"lcm_brightness_override"` LcmNightModeBegins string `json:"lcm_night_mode_begins"` LcmNightModeEnabled FlexBool `json:"lcm_night_mode_enabled"` LcmNightModeEnds string `json:"lcm_night_mode_ends"` LicenseState string `json:"license_state"` Locating FlexBool `json:"locating"` Mac string `fake:"{macaddress}" json:"mac"` ManufacturerID FlexInt `json:"manufacturer_id"` MinIfnromIntervalSeconds FlexInt `json:"min_inform_interval_seconds"` Model string `fake:"{randomstring:[model-1,model-2,model-3]}" json:"model"` ModelIncompatible FlexBool `json:"model_incompatible"` ModelInEOL FlexBool `json:"model_in_eol"` ModelInLTS FlexBool `json:"model_in_lts"` Name string `fake:"{randomstring:[pdu-1,pdu-2]}" json:"name"` NextInterval FlexInt `json:"next_interval"` NumSta FlexInt `json:"num_sta"` OutletACPowerBudget FlexInt `json:"outlet_ac_power_budget"` OutletACPowerConsumption FlexInt `json:"outlet_ac_power_consumption"` OutletEnabled FlexBool `json:"outlet_enabled"` OutletOverrides []OutletOverride `fakesize:"5" json:"outlet_overrides"` OutletTable []OutletTable `fakesize:"5" json:"outlet_table"` Overheating FlexBool `json:"overheating"` PortTable []Port `fakesize:"5" json:"port_table"` PowerSource FlexInt `json:"power_source"` PowerSourceCtrlEnabled FlexBool `json:"power_source_ctrl_enabled"` PrevNonBusyState FlexInt `json:"prev_non_busy_state"` ProvisionedAt FlexInt `json:"provisioned_at"` RequiredVersion string `fake:"{appversion}" json:"required_version"` RollUpgrade FlexBool `json:"rollupgrade"` RxBytes FlexInt `json:"rx_bytes"` Satisfaction FlexInt `json:"satisfaction"` Serial string `fake:"{uuid}" json:"serial"` SetupID string `fake:"{uuid}" json:"setup_id"` SiteID string `fake:"{uuid}" json:"site_id"` SiteName string `fake:"{company}" json:"site_name"` SourceName string `fake:"{animal}" json:"source_name"` StartConnectedMillis FlexInt `json:"start_connected_millis"` StartDisconnectedMillis FlexInt `json:"start_disconnected_millis"` StartupTimestamp FlexInt `json:"startup_timestamp"` Stat PDUStat `json:"stat"` State FlexInt `json:"state"` StpPriority FlexInt `json:"stp_priority"` StpVersion string `fake:"{appversion}" json:"stp_version"` SwitchCaps *SwitchCaps `json:"switch_caps"` SysErrorCaps FlexInt `json:"sys_error_caps"` SyslogKey string `fake:"{animal}" json:"syslog_key"` SysStats SysStats `json:"sys_stats"` SystemStats SystemStats `json:"system-stats"` TotalMaxPower FlexInt `json:"total_max_power"` TwoPhaseAdopt FlexBool `json:"two_phase_adopt"` TxBytes FlexInt `json:"tx_bytes"` Type string `fake:"{lexify:pdu}" json:"type"` Unsupported FlexBool `json:"unsupported"` UnsupportedReason FlexInt `json:"unsupported_reason"` Upgradeable FlexBool `json:"upgradable"` Uplink Uplink `json:"uplink"` UplinkDepth FlexBool `json:"uplink_depth"` Uptime FlexInt `json:"uptime"` UserNumSta FlexInt `json:"user-num_sta"` Version string `fake:"{appversion}" json:"version"` // contains filtered or unexported fields }
PDU is the Smart Power PDU line of products
type PDUStat ¶
type PDUStat struct {
*Sw
}
PDUStat holds the "stat" data for a pdu. This is split out because of a JSON data format change from 5.10 to 5.11.
func (*PDUStat) UnmarshalJSON ¶
UnmarshalJSON unmarshalls 5.10 or 5.11 formatted Switch Stat data.
type Port ¶
type Port struct { AggregatedBy FlexBool `json:"aggregated_by"` Autoneg FlexBool `json:"autoneg,omitempty"` BytesR FlexInt `json:"bytes-r"` DNS []string `fakesize:"5" json:"dns,omitempty"` 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"` IP string `fake:"{ipv4address}" json:"ip,omitempty"` Ifname string `fake:"{randomstring:[wlan0,wlan1,lan0,lan1,vlan1,vlan0,vlan2]}" json:"ifname,omitempty"` IsUplink FlexBool `json:"is_uplink"` Mac string `fake:"{macaddress}" json:"mac,omitempty"` MacTable []MacTable `fakesize:"5" json:"mac_table,omitempty"` Jumbo FlexBool `json:"jumbo,omitempty"` Masked FlexBool `json:"masked"` Media string `json:"media"` Name string `fake:"{animal}" json:"name"` NetworkName string `fake:"{animal}" json:"network_name,omitempty"` Netmask string `json:"netmask,omitempty"` NumPort FlexInt `json:"num_port,omitempty"` 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"` PortDelta PortDelta `json:"port_delta,omitempty"` PortIdx FlexInt `json:"port_idx"` PortPoe FlexBool `fake:"{constFlexBool:true}" 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"` RxRate FlexInt `json:"rx_rate,omitempty"` Satisfaction FlexInt `json:"satisfaction,omitempty"` SatisfactionReason FlexInt `json:"satisfaction_reason"` SFPCompliance string `json:"sfp_compliance"` SFPCurrent FlexInt `json:"sfp_current"` SFPFound FlexBool `fake:"{constFlexBool:true}" json:"sfp_found"` SFPPart string `json:"sfp_part"` SFPRev string `json:"sfp_rev"` SFPRxfault FlexBool `json:"sfp_rxfault"` SFPRxpower FlexInt `json:"sfp_rxpower"` SFPSerial string `json:"sfp_serial"` SFPTemperature FlexInt `json:"sfp_temperature"` SFPTxfault FlexBool `json:"sfp_txfault"` SFPTxpower FlexInt `json:"sfp_txpower"` SFPVendor string `json:"sfp_vendor"` SFPVoltage FlexInt `json:"sfp_voltage"` Speed FlexInt `json:"speed"` SpeedCaps FlexInt `json:"speed_caps"` 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"` TxRate FlexInt `json:"tx_rate,omitempty"` Type string `json:"type,omitempty"` Up FlexBool `json:"up"` }
Port is a physical connection on a USW or Gateway. Not every port has the same capabilities.
type PortDelta ¶
type PortDelta struct { TimeDelta FlexInt `json:"time_delta"` TimeDeltaActivity FlexInt `json:"time_delta_activity"` }
PortDelta is part of a Port.
type RadioTable ¶
type RadioTable []struct { AntennaGain FlexInt `json:"antenna_gain"` BuiltinAntGain FlexInt `json:"builtin_ant_gain"` BuiltinAntenna FlexBool `json:"builtin_antenna"` Channel FlexInt `json:"channel"` CurrentAntennaGain FlexInt `json:"current_antenna_gain"` HasDfs FlexBool `json:"has_dfs"` HasFccdfs FlexBool `json:"has_fccdfs"` HasHt160 FlexBool `json:"has_ht160"` Ht FlexInt `json:"ht"` Is11Ac FlexBool `json:"is_11ac"` MaxTxpower FlexInt `json:"max_txpower"` MinRssi FlexInt `json:"min_rssi,omitempty"` MinRssiEnabled FlexBool `json:"min_rssi_enabled"` MinTxpower FlexInt `json:"min_txpower"` Name string `fake:"{lexify:mock-radio}" json:"name"` Nss FlexInt `json:"nss"` Radio string `json:"radio"` RadioCaps FlexInt `json:"radio_caps"` SensLevelEnabled FlexBool `json:"sens_level_enabled"` TxPower FlexInt `json:"tx_power"` TxPowerMode string `json:"tx_power_mode"` VwireEnabled FlexBool `json:"vwire_enabled"` WlangroupID string `fake:"{uuid}" json:"wlangroup_id"` }
RadioTable is part of the data for UAPs and UDMs.
type RadioTableStats ¶
type RadioTableStats []struct { AstBeXmit FlexInt `json:"ast_be_xmit"` AstCst interface{} `json:"ast_cst"` AstTxto interface{} `json:"ast_txto"` Channel FlexInt `json:"channel"` CuSelfRx FlexInt `json:"cu_self_rx"` CuSelfTx FlexInt `json:"cu_self_tx"` CuTotal FlexInt `json:"cu_total"` Extchannel FlexInt `json:"extchannel"` Gain FlexInt `json:"gain"` GuestNumSta FlexInt `json:"guest-num_sta"` Name string `fake:"{lexify:mock-radio}" json:"name"` NumSta FlexInt `json:"num_sta"` Radio string `json:"radio"` Satisfaction FlexInt `json:"satisfaction"` State string `json:"state"` TxPackets FlexInt `json:"tx_packets"` TxPower FlexInt `json:"tx_power"` TxRetries FlexInt `json:"tx_retries"` UserNumSta FlexInt `json:"user-num_sta"` }
RadioTableStats is part of the data shared between UAP and UDM.
type RogueAP ¶
type RogueAP struct { Age FlexInt `json:"age"` ApMac string `fake:"{macaddress}" json:"ap_mac"` Band string `json:"band"` Bssid string `fake:"{macaddress}" json:"bssid"` Bw FlexInt `json:"bw"` CenterFreq FlexInt `json:"center_freq"` Channel int `json:"channel"` Essid string `fake:"{macaddress}" json:"essid"` Freq FlexInt `json:"freq"` ID string `fake:"{uuid}" json:"_id"` IsAdhoc FlexBool `json:"is_adhoc"` IsRogue FlexBool `json:"is_rogue"` IsUbnt FlexBool `json:"is_ubnt"` LastSeen FlexInt `json:"last_seen"` Noise FlexInt `json:"noise"` Oui string `json:"oui"` Radio string `json:"radio"` RadioName string `json:"radio_name"` ReportTime FlexInt `json:"report_time"` Rssi FlexInt `json:"rssi"` RssiAge FlexInt `json:"rssi_age"` Security string `json:"security"` Signal FlexInt `json:"signal"` SiteID string `fake:"{uuid}" json:"site_id"` SiteName string `json:"-"` SourceName string `json:"-"` }
RogueAP are your neighbors access points.
type ServerStatus ¶
type ServerStatus struct { Up FlexBool `json:"up"` ServerVersion string `fake:"{appversion}" json:"server_version"` UUID string `fake:"{uuid}" json:"uuid"` }
ServerStatus is the /status endpoint from the Unifi controller.
type Site ¶
type Site struct { AttrHiddenID string `json:"attr_hidden_id"` AttrNoDelete FlexBool `json:"attr_no_delete"` Desc string `fake:"{buzzword}" json:"desc"` Health []struct { Drops FlexInt `json:"drops,omitempty"` Gateways []string `fakesize:"5" json:"gateways,omitempty"` GwMac string `fake:"{macaddress}" json:"gw_mac,omitempty"` GwName string `json:"gw_name,omitempty"` GwSystemStats struct { CPU FlexInt `json:"cpu"` Mem FlexInt `json:"mem"` Uptime FlexInt `json:"uptime"` } `json:"gw_system-stats,omitempty"` GwVersion string `fake:"{appversion}" json:"gw_version,omitempty"` LanIP string `json:"lan_ip,omitempty"` Latency FlexInt `json:"latency,omitempty"` Nameservers []string `fakesize:"5" json:"nameservers,omitempty"` Netmask string `json:"netmask,omitempty"` NumAdopted FlexInt `json:"num_adopted,omitempty"` NumAp FlexInt `json:"num_ap,omitempty"` NumDisabled FlexInt `json:"num_disabled,omitempty"` NumDisconnected FlexInt `json:"num_disconnected,omitempty"` NumGuest FlexInt `json:"num_guest,omitempty"` NumGw FlexInt `json:"num_gw,omitempty"` NumIot FlexInt `json:"num_iot,omitempty"` NumPending FlexInt `json:"num_pending,omitempty"` NumSta FlexInt `json:"num_sta,omitempty"` NumSw FlexInt `json:"num_sw,omitempty"` NumUser FlexInt `json:"num_user,omitempty"` RemoteUserEnabled FlexBool `json:"remote_user_enabled,omitempty"` RemoteUserNumActive FlexInt `json:"remote_user_num_active,omitempty"` RemoteUserNumInactive FlexInt `json:"remote_user_num_inactive,omitempty"` RemoteUserRxBytes FlexInt `json:"remote_user_rx_bytes,omitempty"` RemoteUserRxPackets FlexInt `json:"remote_user_rx_packets,omitempty"` RemoteUserTxBytes FlexInt `json:"remote_user_tx_bytes,omitempty"` RemoteUserTxPackets FlexInt `json:"remote_user_tx_packets,omitempty"` RxBytesR FlexInt `json:"rx_bytes-r,omitempty"` SiteToSiteEnabled FlexBool `json:"site_to_site_enabled,omitempty"` SpeedtestLastrun FlexInt `json:"speedtest_lastrun,omitempty"` SpeedtestPing FlexInt `json:"speedtest_ping,omitempty"` SpeedtestStatus string `json:"speedtest_status,omitempty"` Status string `json:"status"` Subsystem string `json:"subsystem"` TxBytesR FlexInt `json:"tx_bytes-r,omitempty"` Uptime FlexInt `json:"uptime,omitempty"` WanIP string `fake:"{ipv4address}" json:"wan_ip,omitempty"` XputDown FlexInt `json:"xput_down,omitempty"` XputUp FlexInt `json:"xput_up,omitempty"` } `fakesize:"5" json:"health"` ID string `fake:"{uuid}" json:"_id"` Name string `fake:"{randomstring:[site-1,site-2]}" json:"name"` NumNewAlarms FlexInt `json:"num_new_alarms"` SiteName string `json:"-"` SourceName string `json:"-"` // contains filtered or unexported fields }
Site represents a site's data.
func (*Site) CancelMigrate ¶
CancelMigrate stops a migration in progress. Probably does not work on devices with built-in controllers like UDM & UXG.
func (*Site) Migrate ¶
Migrate sends a device to another controller's URL. Probably does not work on devices with built-in controllers like UDM & UXG.
func (*Site) SpeedTestStatus ¶
SpeedTestStatus returns the raw response for the status of a speed test. XXX: marshal the response into a data structure. This method will change!
type SpeedtestServer ¶
type SpeedtestStatus ¶
type SpeedtestStatus struct { Latency FlexInt `json:"latency"` Rundate FlexInt `json:"rundate"` Runtime FlexInt `json:"runtime"` Server *SpeedtestServer `json:"server"` ServerDesc string `json:"server_desc,omitempty"` SourceInterface string `json:"source_interface"` StatusDownload FlexInt `json:"status_download"` StatusPing FlexInt `json:"status_ping"` StatusSummary FlexInt `json:"status_summary"` StatusUpload FlexInt `json:"status_upload"` XputDownload FlexInt `json:"xput_download"` XputUpload FlexInt `json:"xput_upload"` }
SpeedtestStatus is the speed test info on a USG or UDM.
type Storage ¶
type Storage struct { MountPoint string `json:"mount_point"` Name string `fake:"{randomstring:[foo,bar]}" json:"name"` Size FlexInt `json:"size"` Type string `fake:"{randomstring:[foo,bar]}" json:"type"` Used FlexInt `json:"used"` }
Storage is hard drive into for a device with storage.
type Sw ¶
type Sw struct { Bytes FlexInt `json:"bytes"` Datetime time.Time `fake:"{recent_time}" json:"datetime"` Duration FlexInt `json:"duration"` O string `json:"o"` Oid string `json:"oid"` RxBroadcast FlexInt `json:"rx_broadcast"` RxBytes FlexInt `json:"rx_bytes"` RxCrypts FlexInt `json:"rx_crypts"` RxDropped FlexInt `json:"rx_dropped"` RxErrors FlexInt `json:"rx_errors"` RxFrags FlexInt `json:"rx_frags"` RxMulticast FlexInt `json:"rx_multicast"` RxPackets FlexInt `json:"rx_packets"` SiteID string `fake:"{uuid}" json:"site_id"` Sw string `json:"sw"` Time FlexInt `json:"time"` TxBroadcast FlexInt `json:"tx_broadcast"` TxBytes FlexInt `json:"tx_bytes"` TxDropped FlexInt `json:"tx_dropped"` TxErrors FlexInt `json:"tx_errors"` TxMulticast FlexInt `json:"tx_multicast"` TxPackets FlexInt `json:"tx_packets"` TxRetries FlexInt `json:"tx_retries"` }
Sw is a subtype of USWStat to make unmarshalling of different controller versions possible.
type SwitchCaps ¶
type SysStats ¶
type SysStats struct { Loadavg1 FlexInt `json:"loadavg_1"` Loadavg15 FlexInt `json:"loadavg_15"` Loadavg5 FlexInt `json:"loadavg_5"` MemBuffer FlexInt `json:"mem_buffer"` MemTotal FlexInt `json:"mem_total"` MemUsed FlexInt `json:"mem_used"` }
SysStats is load info for a UDM, USG, USW.
type SystemStats ¶
type SystemStats struct { CPU FlexInt `json:"cpu"` Mem FlexInt `json:"mem"` Uptime FlexInt `json:"uptime"` // This exists on at least USG4, may others, maybe not. // {"Board (CPU)":"51 C","Board (PHY)":"51 C","CPU":"72 C","PHY":"77 C"} Temps TempStatusByName `fake:"{tempStatusByName}" json:"temps,omitempty"` }
SystemStats is system info for a UDM, USG, USW.
type TempStatusByName ¶
type Temperature ¶
type UAP ¶
type UAP struct { AFTEnabled FlexBool `json:"atf_enabled"` AdoptableWhenUpgraded FlexBool `json:"adoptable_when_upgraded"` Adopted FlexBool `fake:"{constFlexBool:true}" json:"adopted"` AntennaTable []struct { Default FlexBool `json:"default"` ID FlexInt `json:"id"` Name string `fake:"{animal}" json:"name"` Wifi0Gain FlexInt `json:"wifi0_gain"` Wifi1Gain FlexInt `json:"wifi1_gain"` } `fakesize:"5" json:"antenna_table"` Architecture string `json:"architecture"` BandsteeringMode string `json:"bandsteering_mode,omitempty"` BoardRev int `json:"board_rev"` Bytes FlexInt `json:"bytes"` BytesD FlexInt `json:"bytes-d"` BytesR FlexInt `json:"bytes-r"` Cfgversion string `fake:"{appversion}" json:"cfgversion"` ConfigNetwork *ConfigNetwork `json:"config_network"` ConnectRequestIP string `fake:"{ipv4address}" json:"connect_request_ip"` ConnectRequestPort string `json:"connect_request_port"` ConnectedAt FlexInt `json:"connected_at"` CountryCode FlexInt `json:"country_code"` CountrycodeTable []int `fakesize:"5" json:"countrycode_table"` DeviceID string `fake:"{uuid}" json:"device_id"` Dot1XPortctrlEnabled FlexBool `json:"dot1x_portctrl_enabled"` DownlinkTable []*DownlinkTable `fakesize:"5" json:"downlink_table,omitempty"` EthernetTable []*EthernetTable `fakesize:"5" json:"ethernet_table"` FixedAPAvailable FlexBool `json:"fixed_ap_available"` FwCaps int `json:"fw_caps"` GatewayMac string `fake:"{macaddress}" json:"gateway_mac"` GuestNumSta FlexInt `json:"guest-num_sta"` GuestToken string `json:"guest_token"` GuestWlanNumSta FlexInt `json:"guest-wlan-num_sta"` HasEth1 FlexBool `json:"has_eth1"` HasFan FlexBool `json:"has_fan"` HasSpeaker FlexBool `json:"has_speaker"` HasTemperature FlexBool `json:"has_temperature"` HwCaps int `json:"hw_caps"` ID string `fake:"{uuid}" json:"_id"` IP string `fake:"{ipv4address}" json:"ip"` InformIP string `fake:"{ipv4address}" json:"inform_ip"` InformURL string `fake:"{url}" json:"inform_url"` Internet FlexBool `json:"internet"` Isolated FlexBool `json:"isolated"` KernelVersion string `fake:"{appversion}" json:"kernel_version"` KnownCfgversion string `fake:"{appversion}" json:"known_cfgversion"` LastSeen FlexInt `json:"last_seen"` LastUplink struct { UplinkMac string `fake:"{macaddress}" json:"uplink_mac"` UplinkRemotePort int `fake:"{port}" json:"uplink_remote_port"` } `json:"last_uplink"` LcmBrightnessOverride FlexBool `json:"lcm_brightness_override"` LcmTimeoutOverride FlexBool `json:"lcm_idle_timeout_override"` LcmTrackerEnabled FlexBool `json:"lcm_tracker_enabled"` LcmTrackerSeed string `json:"lcm_tracker_seed"` LedOverride string `json:"led_override"` LedOverrideColor string `json:"led_override_color"` LedOverrideColorBrightness FlexInt `json:"led_override_color_brightness"` LicenseState string `json:"license_state"` Locating FlexBool `fake:"{constFlexBool:false}" json:"locating"` LteAPN string `json:"lte_apn"` LteBand string `json:"lte_band"` LteCellID string `json:"lte_cell_id"` LteConnected FlexBool `json:"lte_connected"` LteDataLimitEnabled FlexBool `json:"lte_data_limit_enabled"` LteExtAntenna FlexBool `json:"lte_ext_ant"` LteFailover FlexBool `json:"lte_failover"` LteFailoverMode string `json:"lte_failover_mode"` LteHardLimit FlexInt `json:"lte_hard_limit"` LteICCID string `json:"lte_iccid"` LteIMEI string `json:"lte_imei"` LteIP string `fake:"{ipv4address}" json:"lte_ip"` LteMode string `json:"lte_mode"` LteNetworkOperator string `json:"lte_networkoperator"` LtePdpType string `json:"lte_pdptype"` LtePoe FlexBool `json:"lte_poe"` LteRadio string `json:"lte_radio"` LteRadioMode string `json:"lte_radio_mode"` LteRat string `json:"lte_rat"` LteRsrp FlexInt `json:"lte_rsrp"` LteRsrq FlexInt `json:"lte_rsrq"` LteRssi FlexInt `json:"lte_rssi"` LteRxChannel FlexInt `json:"lte_rx_chan"` LteSignal string `json:"lte_signal"` LteSoftLimit FlexInt `json:"lte_soft_limit"` LteSsoUserUuid string `json:"lte_sso_user_uuid"` //nolint:revive LteState FlexBool `json:"lte_state"` LteSubscriptionApiUnreachable FlexBool `json:"lte_subscription_api_unreachable"` //nolint:revive LteSubscriptionCheckRequired FlexBool `json:"lte_subscription_check_required"` LteSubscriptionStatus FlexBool `json:"lte_subscription_status"` LteTxChannel FlexInt `json:"lte_tx_chan"` Mac string `fake:"{macaddress}" json:"mac"` ManufacturerID FlexInt `json:"manufacturer_id"` MeshStaVapEnabled FlexBool `json:"mesh_sta_vap_enabled"` Meshv3PeerMac string `json:"meshv3_peer_mac"` Model string `json:"model"` ModelInEOL FlexBool `json:"model_in_eol"` ModelInLTS FlexBool `json:"model_in_lts"` ModelIncompatible FlexBool `json:"model_incompatible"` Name string `fake:"{randomstring:[uap-1,uap-2]}" json:"name"` NumSta FlexInt `json:"num_sta"` OutdoorModeOverride string `json:"outdoor_mode_override"` PortTable []Port `fakesize:"5" json:"port_table"` ProvisionedAt FlexInt `json:"provisioned_at"` RadioTable RadioTable `json:"radio_table"` RadioTableStats RadioTableStats `json:"radio_table_stats"` RequiredVersion string `fake:"{appversion}" json:"required_version"` Rollupgrade FlexBool `json:"rollupgrade"` RxBytes FlexInt `json:"rx_bytes"` RxBytesD FlexInt `json:"rx_bytes-d"` SSHSessionTable []interface{} `json:"ssh_session_table"` Satisfaction FlexInt `json:"satisfaction"` ScanRadioTable []interface{} `json:"scan_radio_table"` Scanning FlexBool `json:"scanning"` Serial string `json:"serial"` SiteID string `fake:"{uuid}" json:"site_id"` SiteName string `json:"-"` SourceName string `json:"-"` SpectrumScanning FlexBool `json:"spectrum_scanning"` StartConnectedMillis FlexInt `json:"start_connected_millis"` StartDisconnectedMillis FlexInt `json:"start_disconnected_millis"` StartupTimestamp FlexInt `json:"startup_timestamp"` Stat UAPStat `json:"stat"` State FlexInt `json:"state"` SupportsFingerprintML FlexBool `json:"supports_fingerprint_ml"` SysErrorCaps int `json:"sys_error_caps"` SysStats SysStats `json:"sys_stats"` SyslogKey string `json:"syslog_key"` SystemStats SystemStats `json:"system-stats"` TotalRxBytes FlexInt `json:"total_rx_bytes"` TotalTxBytes FlexInt `json:"total_tx_bytes"` TwoPhaseAdopt FlexBool `json:"two_phase_adopt,omitempty"` TxBytes FlexInt `json:"tx_bytes"` TxBytesD FlexInt `json:"tx_bytes-d"` Type string `fake:"{lexify:uap}" json:"type"` UUptime FlexInt `json:"_uptime"` Unsupported FlexBool `json:"unsupported"` UnsupportedReason FlexInt `json:"unsupported_reason"` Upgradable FlexBool `json:"upgradable"` UpgradeState FlexInt `json:"upgrade_state"` Uplink struct { FullDuplex FlexBool `json:"full_duplex"` IP string `fake:"{ipv4address}" json:"ip"` Mac string `fake:"{macaddress}" json:"mac"` MaxVlan int `json:"max_vlan"` Name string `json:"name"` Netmask string `json:"netmask"` NumPort int `fake:"{port}" json:"num_port"` RxBytes FlexInt `json:"rx_bytes"` RxDropped FlexInt `json:"rx_dropped"` RxErrors FlexInt `json:"rx_errors"` RxMulticast FlexInt `json:"rx_multicast"` RxPackets FlexInt `json:"rx_packets"` Speed FlexInt `json:"speed"` TxBytes FlexInt `json:"tx_bytes"` TxDropped FlexInt `json:"tx_dropped"` TxErrors FlexInt `json:"tx_errors"` TxPackets FlexInt `json:"tx_packets"` Up FlexBool `json:"up"` MaxSpeed FlexInt `json:"max_speed"` Type string `json:"type"` TxBytesR FlexInt `json:"tx_bytes-r"` RxBytesR FlexInt `json:"rx_bytes-r"` UplinkMac string `fake:"{macaddress}" json:"uplink_mac"` UplinkRemotePort int `fake:"{port}" json:"uplink_remote_port"` } `json:"uplink"` UplinkTable []interface{} `json:"uplink_table"` Uptime FlexInt `json:"uptime"` UserNumSta FlexInt `json:"user-num_sta"` UserWlanNumSta FlexInt `json:"user-wlan-num_sta"` VapTable VapTable `json:"vap_table"` Version string `fake:"{appversion}" json:"version"` VwireEnabled FlexBool `json:"vwireEnabled"` VwireTable []interface{} `json:"vwire_table"` VwireVapTable []interface{} `json:"vwire_vap_table"` WifiCaps int `json:"wifi_caps"` WlangroupIDNa string `json:"wlangroup_id_na"` WlangroupIDNg string `json:"wlangroup_id_ng"` // contains filtered or unexported fields }
UAP represents all the data from the Ubiquiti Controller for a Unifi Access Point. This was auto generated then edited by hand to get all the data types right.
func (*UAP) CancelMigrate ¶
CancelMigrate stops an access point migration in progress.
type UAPStat ¶
type UAPStat struct {
*Ap
}
UAPStat holds the "stat" data for an access point. This is split out because of a JSON data format change from 5.10 to 5.11.
func (*UAPStat) UnmarshalJSON ¶
UnmarshalJSON unmarshalls 5.10 or 5.11 formatted Access Point Stat data.
type UDM ¶
type UDM struct { AFTEnabled FlexBool `json:"atf_enabled"` AdoptIP string `fake:"{ipv4address}" json:"adopt_ip"` AdoptManual FlexBool `json:"adopt_manual"` AdoptState FlexInt `json:"adopt_state"` AdoptStatus FlexInt `json:"adopt_status"` AdoptTries FlexInt `json:"adopt_tries"` AdoptURL string `fake:"{url}" json:"adopt_url"` AdoptableWhenUpgraded FlexBool `fake:"{constFlexBool:true}" json:"adoptable_when_upgraded"` Adopted FlexBool `fake:"{constFlexBool:true}" json:"adopted"` AdoptionCompleted FlexBool `fake:"{constFlexBool:true}" json:"adoption_completed"` Architecture string `json:"architecture"` BandsteeringMode string `json:"bandsteering_mode"` BoardRev FlexInt `json:"board_rev"` Bytes FlexInt `json:"bytes"` BytesD FlexInt `json:"bytes-d"` BytesR FlexInt `json:"bytes-r"` Cfgversion string `fake:"{appversion}" json:"cfgversion"` ConfigNetwork *ConfigNetwork `json:"config_network"` ConnectRequestIP string `fake:"{ipv4address}" json:"connect_request_ip"` ConnectRequestPort string `json:"connect_request_port"` ConnectedAt FlexInt `json:"connected_at"` ConnectionNetworkName string `json:"connection_network_name"` Default FlexBool `json:"default"` DeviceDomain string `json:"device_domain"` DeviceID string `fake:"{uuid}" json:"device_id"` DiscoveredVia string `json:"discovered_via"` DisplayableVersion string `fake:"{appversion}" json:"displayable_version"` Dot1XPortctrlEnabled FlexBool `json:"dot1x_portctrl_enabled"` DownlinkTable []*DownlinkTable `fakesize:"5" json:"downlink_table"` EthernetOverrides []*EthernetOverrides `fakesize:"5" json:"ethernet_overrides"` EthernetTable []*EthernetTable `fakesize:"5" json:"ethernet_table"` FlowctrlEnabled FlexBool `json:"flowctrl_enabled"` FwCaps FlexInt `json:"fw_caps"` GeoInfo map[string]GeoInfo `fakesize:"5" json:"geo_info"` GuestKicks FlexInt `json:"guest_kicks"` GuestLanNumSta FlexInt `json:"guest-lan-num_sta"` // USW GuestNumSta FlexInt `json:"guest-num_sta"` // USG GuestToken string `json:"guest_token"` GuestWlanNumSta FlexInt `json:"guest-wlan-num_sta"` // UAP HasEth1 FlexBool `json:"has_eth1"` HasFan FlexBool `json:"has_fan"` HasSpeaker FlexBool `json:"has_speaker"` HasTemperature FlexBool `json:"has_temperature"` HwCaps FlexInt `json:"hw_caps"` ID string `fake:"{uuid}" json:"_id"` IP string `fake:"{ipv4address}" json:"ip"` InformIP string `fake:"{ipv4address}" json:"inform_ip"` InformURL string `fake:"{url}" json:"inform_url"` Internet FlexBool `json:"internet"` IsAccessPoint FlexBool `json:"is_access_point"` JumboframeEnabled FlexBool `json:"jumboframe_enabled"` KernelVersion string `fake:"{appversion}" json:"kernel_version"` KnownCfgversion string `fake:"{appversion}" json:"known_cfgversion"` LanIP string `fake:"{ipv4address}" json:"lan_ip"` LanNumSta FlexInt `json:"lan-num_sta"` // USW LastLteFailoverTransitionTimestamp FlexInt `json:"last_lte_failover_transition_timestamp"` LastSeen FlexInt `json:"last_seen"` LastWlanIP string `fake:"{ipv4address}" json:"last_wan_ip"` LcmBrightness FlexInt `json:"lcm_brightness"` LcmNightModeBegins string `json:"lcm_night_mode_begins"` LcmNightModeEnabled FlexBool `json:"lcm_night_mode_enabled"` LcmNightModeEnds string `json:"lcm_night_mode_ends"` LcmTrackerEnabled FlexBool `json:"lcm_tracker_enabled"` LcmTrackerSeed string `json:"lcm_tracker_seed"` LicenseState string `json:"license_state"` Locating FlexBool `fake:"{constFlexBool:false}" json:"locating"` Mac string `fake:"{macaddress}" json:"mac"` ManufacturerID FlexInt `json:"manufacturer_id"` MinInformIntervalSeconds FlexInt `json:"min_inform_interval_seconds"` Model string `json:"model"` ModelInEOL FlexBool `json:"model_in_eol"` ModelInLTS FlexBool `json:"model_in_lts"` ModelIncompatible FlexBool `json:"model_incompatible"` Name string `fake:"{animal}" json:"name"` NetworkTable NetworkTable `json:"network_table"` NextInterval FlexInt `json:"next_interval"` NumDesktop FlexInt `json:"num_desktop"` // USG NumHandheld FlexInt `json:"num_handheld"` // USG NumMobile FlexInt `json:"num_mobile"` // USG NumSta FlexInt `json:"num_sta"` // USG Overheating FlexBool `json:"overheating"` PortOverrides []struct { PortIdx FlexInt `json:"port_idx"` PortconfID string `json:"portconf_id"` } `fakesize:"5" json:"port_overrides"` PortTable []Port `fakesize:"5" json:"port_table"` PowerSourceCtrlEnabled FlexBool `json:"power_source_ctrl_enabled"` ProvisionedAt FlexInt `json:"provisioned_at"` RadioTable *RadioTable `json:"radio_table,omitempty"` RadioTableStats *RadioTableStats `json:"radio_table_stats,omitempty"` RequiredVersion string `fake:"{appversion}" json:"required_version"` RollUpgrade FlexBool `json:"rollupgrade"` RulesetInterfaces interface{} `json:"ruleset_interfaces"` /* struct { Br0 string `json:"br0"` Eth0 string `json:"eth0"` Eth1 string `json:"eth1"` Eth2 string `json:"eth2"` Eth3 string `json:"eth3"` Eth4 string `json:"eth4"` Eth5 string `json:"eth5"` Eth6 string `json:"eth6"` Eth7 string `json:"eth7"` Eth8 string `json:"eth8"` } */ RxBytes FlexInt `json:"rx_bytes"` RxBytesD FlexInt `json:"rx_bytes-d"` Serial string `json:"serial"` SetupProvisionCompleted FlexBool `json:"setup_provision_completed"` SetupProvisionTracking FlexBool `json:"setup_provision_tracking"` SiteID string `fake:"{uuid}" json:"site_id"` SiteName string `json:"-"` SourceName string `json:"-"` SpeedtestStatus SpeedtestStatus `json:"speedtest-status"` SpeedtestStatusSaved FlexBool `json:"speedtest-status-saved"` StartupConnectedMillis FlexInt `json:"start_connected_millis"` StartupDisconnectedMillis FlexInt `json:"start_disconnected_millis"` StartupTimestamp FlexInt `json:"startup_timestamp"` Stat UDMStat `json:"stat"` State FlexInt `json:"state"` Storage []*Storage `fakesize:"5" json:"storage"` StpPriority FlexInt `json:"stp_priority"` StpVersion string `fake:"{appversion}" json:"stp_version"` SwitchCaps struct { MaxMirrorSessions FlexInt `json:"max_mirror_sessions"` MaxAggregateSessions FlexInt `json:"max_aggregate_sessions"` } `json:"switch_caps"` SysStats SysStats `json:"sys_stats"` SyslogKey string `json:"syslog_key"` SystemStats SystemStats `json:"system-stats"` TeleportVersion FlexInt `json:"teleport_version"` Temperatures []Temperature `fakesize:"5" json:"temperatures,omitempty"` TwoPhaseAdopt FlexBool `json:"two_phase_adopt"` TxBytes FlexInt `json:"tx_bytes"` TxBytesD FlexInt `json:"tx_bytes-d"` Type string `fake:"{lexify:udm}" json:"type"` UdapiCaps FlexInt `json:"udapi_caps"` UnifiCare struct { ActivationDismissed FlexBool `json:"activation_dismissed"` ActivationEnd FlexInt `json:"activation_end"` ActivationUrl string `fake:"{url}" json:"activation_url"` //nolint:revive CoverageEnd FlexInt `json:"coverage_end"` CoverageStart FlexInt `json:"coverage_start"` Registration FlexInt `json:"registration"` RmaUrl string `fake:"{url}" json:"rma_url"` //nolint:revive State string `json:"state"` TrackingUrl string `fake:"{url}" json:"tracking_url"` //nolint:revive } `json:"unifi_care"` Unsupported FlexBool `json:"unsupported"` UnsupportedReason FlexInt `json:"unsupported_reason"` UpgradeState FlexInt `json:"upgrade_state"` Upgradeable FlexBool `json:"upgradable"` Uplink Uplink `json:"uplink"` Uptime FlexInt `json:"uptime"` UserLanNumSta FlexInt `json:"user-lan-num_sta"` // USW UserNumSta FlexInt `json:"user-num_sta"` // USG UserWlanNumSta FlexInt `json:"user-wlan-num_sta"` // UAP UsgCaps FlexInt `json:"usg_caps"` VapTable *VapTable `json:"vap_table"` Version string `fake:"{appversion}" json:"version"` VwireTable []interface{} `json:"vwire_table"` Wan1 Wan `json:"wan1"` Wan2 Wan `json:"wan2"` WifiCaps FlexInt `json:"wifi_caps"` WlanNumSta FlexInt `json:"wlan-num_sta"` // UAP WlangroupIDNa string `json:"wlangroup_id_na"` WlangroupIDNg string `json:"wlangroup_id_ng"` XInformAuthkey string `json:"x_inform_authkey"` // contains filtered or unexported fields }
UDM represents all the data from the Ubiquiti Controller for a Unifi Dream Machine. The UDM shares several structs/type-data with USW and USG.
type UDMStat ¶
UDMStat holds the "stat" data for a dream machine. A dream machine is a USG + USW + Controller.
type USG ¶
type USG struct { AdoptableWhenUpgraded FlexBool `json:"adoptable_when_upgraded"` Adopted FlexBool `fake:"{constFlexBool:true}" json:"adopted"` BoardRev FlexInt `json:"board_rev"` Bytes FlexInt `json:"bytes"` Cfgversion string `fake:"{appversion}" json:"cfgversion"` ConfigNetwork *ConfigNetwork `json:"config_network"` ConnectRequestIP string `fake:"{ipv4address}" json:"connect_request_ip"` ConnectRequestPort string `json:"connect_request_port"` DeviceID string `fake:"{uuid}" json:"device_id"` EthernetOverrides []*EthernetOverrides `fakesize:"5" json:"ethernet_overrides"` EthernetTable []*EthernetTable `fakesize:"5" json:"ethernet_table"` FwCaps FlexInt `json:"fw_caps"` GuestNumSta FlexInt `json:"guest-num_sta"` GuestToken string `json:"guest_token"` HwCaps FlexInt `json:"hw_caps"` ID string `fake:"{uuid}" json:"_id"` InformIP string `fake:"{ipv4address}" json:"inform_ip"` InformURL string `fake:"{url}" json:"inform_url"` IP string `fake:"{ipv4address}" json:"ip"` KnownCfgversion string `fake:"{appversion}" json:"known_cfgversion"` LastSeen FlexInt `json:"last_seen"` LedOverride string `json:"led_override"` LicenseState string `json:"license_state"` Locating FlexBool `fake:"{constFlexBool:false}" json:"locating"` Mac string `fake:"{macaddress}" json:"mac"` Model string `json:"model"` Name string `fake:"{animal}" json:"name"` NetworkTable NetworkTable `json:"network_table"` NumDesktop FlexInt `json:"num_desktop"` NumHandheld FlexInt `json:"num_handheld"` NumMobile FlexInt `json:"num_mobile"` NumSta FlexInt `json:"num_sta"` OutdoorModeOverride string `json:"outdoor_mode_override"` PortTable []*Port `fakesize:"5" json:"port_table"` RequiredVersion string `fake:"{appversion}" json:"required_version"` Rollupgrade FlexBool `json:"rollupgrade"` RxBytes FlexInt `json:"rx_bytes"` Serial string `json:"serial"` SiteID string `fake:"{uuid}" json:"site_id"` SiteName string `json:"-"` SourceName string `json:"-"` SpeedtestStatus SpeedtestStatus `json:"speedtest-status"` SpeedtestStatusSaved FlexBool `json:"speedtest-status-saved"` Stat USGStat `json:"stat"` State FlexInt `json:"state"` SysStats SysStats `json:"sys_stats"` SystemStats SystemStats `json:"system-stats"` Temperatures []Temperature `fakesize:"5" json:"temperatures,omitempty"` TxBytes FlexInt `json:"tx_bytes"` Type string `fake:"{lexify:usg}" json:"type"` Unsupported FlexBool `json:"unsupported"` UnsupportedReason FlexInt `json:"unsupported_reason"` Upgradable FlexBool `json:"upgradable"` Uplink Uplink `json:"uplink"` Uptime FlexInt `json:"uptime"` UserNumSta FlexInt `json:"user-num_sta"` UsgCaps FlexInt `json:"usg_caps"` Version string `fake:"{appversion}" json:"version"` Wan1 Wan `json:"wan1"` Wan2 Wan `json:"wan2"` // contains filtered or unexported fields }
USG represents all the data from the Ubiquiti Controller for a Unifi Security Gateway.
func (*USG) CancelMigrate ¶
CancelMigrate stops a security gateway migration in progress.
type USGStat ¶
type USGStat struct {
*Gw
}
USGStat holds the "stat" data for a gateway. This is split out because of a JSON data format change from 5.10 to 5.11.
func (*USGStat) UnmarshalJSON ¶
UnmarshalJSON unmarshalls 5.10 or 5.11 formatted Gateway Stat data.
type USW ¶
type USW struct { AdoptableWhenUpgraded FlexBool `json:"adoptable_when_upgraded,omitempty"` Adopted FlexBool `fake:"{constFlexBool:true}" json:"adopted"` AdoptionCompleted FlexBool `json:"adoption_completed"` Anomalies FlexInt `json:"anomalies"` Architecture string `json:"architecture"` BoardRev FlexInt `json:"board_rev"` Bytes FlexInt `json:"bytes"` Cfgversion string `json:"cfgversion"` ConfigNetwork *ConfigNetwork `json:"config_network"` ConnectRequestIP string `json:"connect_request_ip"` ConnectRequestPort string `json:"connect_request_port"` ConnectedAt FlexInt `json:"connected_at"` ConnectionNetworkName string `json:"connection_network_name"` DeviceID string `json:"device_id"` DisplayableVersion string `json:"displayable_version"` Dot1XPortctrlEnabled FlexBool `json:"dot1x_portctrl_enabled"` DownlinkTable []*DownlinkTable `json:"downlink_table"` EthernetTable []*EthernetTable `json:"ethernet_table"` FanLevel FlexInt `json:"fan_level"` FlowctrlEnabled FlexBool `json:"flowctrl_enabled"` FwCaps FlexInt `json:"fw_caps"` GatewayMac string `json:"gateway_mac"` GeneralTemperature FlexInt `json:"general_temperature"` GuestNumSta FlexInt `json:"guest-num_sta"` HasFan FlexBool `json:"has_fan"` HasTemperature FlexBool `json:"has_temperature"` HwCaps FlexInt `json:"hw_caps"` ID string `json:"_id"` IP string `json:"ip"` InformIP string `json:"inform_ip"` InformURL string `json:"inform_url"` IsAccessPoint FlexBool `json:"is_access_point"` JumboframeEnabled FlexBool `json:"jumboframe_enabled"` KernelVersion string `json:"kernel_version"` KnownCfgversion string `json:"known_cfgversion"` LCMTrackerEnabled FlexBool `json:"lcm_tracker_enabled"` LastSeen FlexInt `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 `fake:"{constFlexBool:false}" json:"locating"` Mac string `json:"mac"` ManufacturerID FlexInt `json:"manufacturer_id"` MinInformIntervalSeconds FlexInt `json:"min_inform_interval_seconds"` Model string `json:"model"` ModelInEOL FlexBool `json:"model_in_eol"` ModelInLTS FlexBool `json:"model_in_lts"` ModelIncompatible FlexBool `json:"model_incompatible"` Name string `fake:"{animal}" json:"name"` NextInterval FlexInt `json:"next_interval"` NumSta FlexInt `json:"num_sta"` OutdoorModeOverride string `json:"outdoor_mode_override"` Overheating FlexBool `json:"overheating"` PortOverrides []struct { Name string `fake:"{randomstring:[override-1,override-2]}" json:"name,omitempty"` PoeMode string `json:"poe_mode,omitempty"` PortIdx FlexInt `json:"port_idx"` PortconfID string `json:"portconf_id"` } `json:"port_overrides"` PortTable []Port `json:"port_table"` PowerSource string `json:"power_source"` PowerSourceCtrlEnabled FlexBool `json:"power_source_ctrl_enabled"` PowerSourceVoltage string `json:"power_source_voltage"` PreviousNonBusyState FlexInt `json:"prev_non_busy_state"` ProvisionedAt FlexInt `json:"provisioned_at"` RequiredVersion string `json:"required_version"` Rollupgrade FlexBool `json:"rollupgrade,omitempty"` RxBytes FlexInt `json:"rx_bytes"` Satisfaction FlexInt `json:"satisfaction"` Serial string `json:"serial"` SetupID string `json:"setup_id"` SiteID string `json:"site_id"` SiteName string `json:"-"` SourceName string `json:"-"` StartConnectedMillis FlexInt `json:"start_connected_millis"` StartDisconnectedMillis FlexInt `json:"start_disconnected_millis"` StartupTimestamp FlexInt `json:"startup_timestamp"` Stat USWStat `json:"stat"` State FlexInt `json:"state"` StpPriority FlexInt `json:"stp_priority"` StpVersion string `json:"stp_version"` SwitchCaps *SwitchCaps `json:"switch_caps"` SysErrorCaps FlexInt `json:"sys_error_caps"` SysStats SysStats `json:"sys_stats"` SystemStats SystemStats `json:"system-stats"` TotalMaxPower FlexInt `json:"total_max_power"` TwoPhaseAdopt FlexBool `json:"two_phase_adopt"` TxBytes FlexInt `json:"tx_bytes"` Type string `fake:"{randomstring:[usg,pdu]}" json:"type"` Unsupported FlexBool `json:"unsupported"` UnsupportedReason FlexInt `json:"unsupported_reason"` Upgradable FlexBool `json:"upgradable,omitempty"` Upgradeable FlexBool `json:"upgradeable"` Uplink Uplink `json:"uplink"` UplinkDepth FlexInt `json:"uplink_depth"` Uptime FlexInt `json:"uptime"` UserNumSta FlexInt `json:"user-num_sta"` Version string `json:"version"` // contains filtered or unexported fields }
USW represents all the data from the Ubiquiti Controller for a Unifi Switch.
func (*USW) CancelMigrate ¶
CancelMigrate stops a switch migration in progress.
func (*USW) PowerCycle ¶
PowerCycle shuts off the PoE and turns it back on for a specific port. Get a USW from the device list to call this.
type USWStat ¶
type USWStat struct {
*Sw
}
USWStat holds the "stat" data for a switch. This is split out because of a JSON data format change from 5.10 to 5.11.
func (*USWStat) UnmarshalJSON ¶
UnmarshalJSON unmarshalls 5.10 or 5.11 formatted Switch Stat data.
type UXG ¶
type UXG struct { AdoptableWhenUpgraded FlexBool `json:"adoptable_when_upgraded"` Adopted FlexBool `fake:"{constFlexBool:true}" json:"adopted"` AdoptedByClient string `json:"adopted_by_client"` AdoptionCompleted FlexBool `json:"adoption_completed"` AnonID string `json:"anon_id"` Architecture string `json:"architecture"` BoardRev FlexInt `json:"board_rev"` Bytes FlexInt `json:"bytes"` Cfgversion string `json:"cfgversion"` ConfigNetwork *ConfigNetwork `json:"config_network"` ConfigNetworkLan *ConfigNetworkLan `json:"config_network_lan"` ConnectedAt FlexInt `json:"connected_at"` ConnectionNetworkName string `json:"connection_network_name"` ConnectRequestIP string `json:"connect_request_ip"` ConnectRequestPort string `json:"connect_request_port"` ConsideredLostAt FlexInt `json:"considered_lost_at"` DeviceID string `fake:"{uuid}" json:"device_id"` DisplayableVersion string `json:"displayable_version"` DownlinkTable []*DownlinkTable `fakesize:"5" json:"downlink_table"` EthernetOverrides []*EthernetOverrides `fakesize:"5" json:"ethernet_overrides"` EthernetTable []*EthernetTable `fakesize:"5" json:"ethernet_table"` FwCaps FlexInt `json:"fw_caps"` GeoInfo map[string]*GeoInfo `fakesize:"5" json:"geo_info"` GuestKicks FlexInt `json:"guest_kicks"` GuestLanNumSta FlexInt `json:"guest-lan-num_sta"` GuestNumSta FlexInt `json:"guest-num_sta"` GuestToken string `json:"guest_token"` GuestWlanNumSta FlexInt `json:"guest-wlan-num_sta"` HasEth1 FlexBool `json:"has_eth1"` HasFan FlexBool `json:"has_fan"` HashID string `json:"hash_id"` HasSpeaker FlexBool `json:"has_speaker"` HasTemperature FlexBool `json:"has_temperature"` HwCaps FlexInt `json:"hw_caps"` ID string `fake:"{uuid}" json:"_id"` InformIP string `fake:"{ipv4address}" json:"inform_ip"` InformURL string `fake:"{url}" json:"inform_url"` Internet FlexBool `json:"internet"` IP string `fake:"{ipv4address}" json:"ip"` IsAccessPoint FlexBool `json:"is_access_point"` KernelVersion string `json:"kernel_version"` KnownCfgversion string `json:"known_cfgversion"` LanNumSta FlexInt `json:"lan-num_sta"` LastSeen FlexInt `json:"last_seen"` LastWanIP string `json:"last_wan_ip"` LcmBrightness FlexInt `json:"lcm_brightness"` LcmBrightnessOverride FlexBool `json:"lcm_brightness_override"` LcmIdleTimeoutOverride FlexBool `json:"lcm_idle_timeout_override"` LcmNightModeBegins string `json:"lcm_night_mode_begins"` LcmNightModeEnabled FlexBool `json:"lcm_night_mode_enabled"` LcmNightModeEnds string `json:"lcm_night_mode_ends"` LedOverride string `json:"led_override"` LedOverrideColor string `json:"led_override_color"` LedOverrideColorBrightness FlexInt `json:"led_override_color_brightness"` LedState *LedState `json:"led_state"` LicenseState string `json:"license_state"` Locating FlexBool `fake:"{constFlexBool:false}" json:"locating"` Mac string `fake:"{macaddress}" json:"mac"` ManufacturerID FlexInt `json:"manufacturer_id"` MinInformIntervalSeconds FlexInt `json:"min_inform_interval_seconds"` Model string `json:"model"` ModelIncompatible FlexBool `json:"model_incompatible"` ModelInEol FlexBool `json:"model_in_eol"` ModelInLts FlexBool `json:"model_in_lts"` Name string `fake:"{animal}" json:"name"` NetworkTable NetworkTable `json:"network_table"` NextHeartbeatAt FlexInt `json:"next_heartbeat_at"` NextInterval FlexInt `json:"next_interval"` NumDesktop FlexInt `json:"num_desktop"` NumHandheld FlexInt `json:"num_handheld"` NumMobile FlexInt `json:"num_mobile"` NumSta FlexInt `json:"num_sta"` OutdoorModeOverride string `json:"outdoor_mode_override"` OutdoorPowerCycleEnabled FlexBool `json:"outlet_power_cycle_enabled"` Overheating FlexBool `json:"overheating"` PortTable []Port `json:"port_table"` ProvisionedAt FlexInt `json:"provisioned_at"` RequiredVersion string `json:"required_version"` RollUpgrade FlexBool `json:"rollupgrade"` RulesetInterfaces interface{} `json:"ruleset_interfaces"` RxBytes FlexInt `json:"rx_bytes"` Serial string `json:"serial"` SetupID string `json:"setup_id"` SiteID string `fake:"{uuid}" json:"site_id"` SiteName string `json:"-"` SourceName string `json:"-"` SpeedtestStatus SpeedtestStatus `json:"speedtest-status"` SpeedtestStatusSaved FlexBool `json:"speedtest-status-saved"` StartConnectedMillis FlexInt `json:"start_connected_millis"` StartDisconnectedMillis FlexInt `json:"start_disconnected_millis"` StartupTimestamp FlexInt `json:"startup_timestamp"` Stat *UXGStat `json:"stat"` State FlexInt `json:"state"` Storage []*Storage `json:"storage"` SwitchCaps *SwitchCaps `json:"switch_caps"` SyslogKey string `json:"syslog_key"` SysStats SysStats `json:"sys_stats"` SystemStats SystemStats `json:"system-stats"` TeleportVersion string `json:"teleport_version"` Temperatures []Temperature `json:"temperatures"` TwoPhaseAdopt FlexBool `json:"two_phase_adopt"` TxBytes FlexInt `json:"tx_bytes"` Type string `fake:"{lexify:uxg}" json:"type"` UdapiCaps FlexInt `json:"udapi_caps"` UnderscoreUptime FlexInt `json:"_uptime"` Unsupported FlexBool `json:"unsupported"` UnsupportedReason FlexInt `json:"unsupported_reason"` UpgradeState FlexInt `json:"upgrade_state"` Uplink Uplink `json:"uplink"` Uptime FlexInt `json:"uptime"` UptimeStats map[string]*UptimeStats `json:"uptime_stats"` UserLanNumSta FlexInt `json:"user-lan-num_sta"` UserNumSta FlexInt `json:"user-num_sta"` UserWlanNumSta FlexInt `json:"user-wlan-num_sta"` UsgCaps FlexInt `json:"usg_caps"` Version string `json:"version"` Wan1 Wan `json:"wan1"` Wan2 Wan `json:"wan2"` WifiCaps FlexInt `json:"wifi_caps"` WlanNumSta FlexInt `json:"wlan-num_sta"` // contains filtered or unexported fields }
UXG represents all the data from the Ubiquiti Controller for a UniFi 10Gb Gateway. The UDM shares several structs/type-data with USW and USG.
func (*UXG) CancelMigrate ¶
CancelMigrate stops 10Gb gateway a migration in progress.
type Unifi ¶
type Unifi struct { *http.Client *Config *ServerStatus // 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. Do not set the loggers to nil. Set them to DiscardLogs if you want no logs.
func NewUnifi ¶
NewUnifi creates a http.Client with authenticated cookies. Used to make additional, authenticated requests to the APIs. Start here.
func (*Unifi) DownloadClip ¶
Prepare and download a clip from the specified camera for the time window then return a temp file where it's located. See GetClipBytes for more.
func (*Unifi) GetAlarmsSite ¶
GetAlarmsSite retreives the Alarms for a single Site.
func (*Unifi) GetAnomalies ¶
GetAnomalies returns Anomalies for a list of Sites.
func (*Unifi) GetAnomaliesSite ¶
GetAnomaliesSite retreives the Anomalies for a single Site.
func (*Unifi) GetCameraByName ¶
Acutally retreived by "displayName", in testing "name" was not always present (null value) while "displayName" always was. If it was present they were always identitcal.
func (*Unifi) GetCameras ¶
func (*Unifi) GetClients ¶
GetClients returns a response full of clients' data from the UniFi Controller.
func (*Unifi) GetClientsDPI ¶
GetClientsDPI garners dpi data for clients.
func (*Unifi) GetClipBytes ¶
Prepare and download a clip from the specified camera for the time window. In testing, the prepare API can be overloaded and will start throwing 500 errors. Two other major errors yet to be understood exist. The first relates to the length of the clip, sometimes the clip is either shorter or longer than the specified time. The second has to do with requesting clips from time periods too close to "now", Unifi will return 500 if this is the case.
func (*Unifi) GetData ¶
GetData makes a unifi request and unmarshals the response into a provided pointer.
func (*Unifi) GetDevices ¶
GetDevices returns a response full of devices' data from the UniFi Controller.
func (*Unifi) GetEvents ¶
GetEvents returns a response full of UniFi Events for the last 1 hour from multiple sites.
func (*Unifi) GetIDS ¶
GetIDS returns Intrusion Detection Systems events for a list of Sites. timeRange may have a length of 0, 1 or 2. The first time is Start, the second is End. Events between start and end are returned. End defaults to time.Now(). nolint: revive
func (*Unifi) GetIDSSite ¶
GetIDSSite retrieves the Intrusion Detection System Data for a single Site. timeRange may have a length of 0, 1 or 2. The first time is Start, the second is End. Events between start and end are returned. End defaults to time.Now().
func (*Unifi) GetNetworks ¶
GetNetworks returns a response full of network data from the UniFi Controller.
func (*Unifi) GetRaw ¶
GetData makes a unifi request and unmarshals the response into a provided pointer.
func (*Unifi) GetRogueAPs ¶
GetRogueAPs returns RogueAPs for a list of Sites. Use GetRogueAPsSite if you want more control.
func (*Unifi) GetRogueAPsSite ¶
GetRogueAPsSite returns RogueAPs for a single Site.
func (*Unifi) GetServerData ¶
func (u *Unifi) GetServerData() (*ServerStatus, error)
GetServerData sets the controller's version and UUID. Only call this if you previously called Login and suspect the controller version has changed.
func (*Unifi) GetSiteDPI ¶
GetSiteDPI garners dpi data for sites.
func (*Unifi) GetSiteEvents ¶
GetSiteEvents retrieves the last 1 hour's worth of events from a single site.
func (*Unifi) GetUsers ¶
GetUsers returns a response full of clients that connected to the UDM within the provided amount of time using the insight historical connection data set.
func (*Unifi) Login ¶
Login is a helper method. It can be called to grab a new authentication cookie.
func (*Unifi) PostJSON ¶
PostJSON uses a POST call and returns the raw JSON in the same way as GetData Use this if you want to change data via the REST API.
func (*Unifi) PutData ¶
PutData makes a unifi request and unmarshals the response into a provided pointer.
func (*Unifi) PutJSON ¶
PutJSON uses a PUT call and returns the raw JSON in the same way as GetData Use this if you want to change data via the REST API.
func (*Unifi) UniReq ¶
UniReq is a small helper function that adds an Accept header. Use this if you're unmarshalling UniFi data into custom types. And if you're doing that... sumbut a pull request with your new struct. :) This is a helper method that is exposed for convenience.
func (*Unifi) UniReqPost ¶
UniReqPost is the Post call equivalent to UniReq.
type UnifiClient ¶
type UnifiClient interface { // GetAlarms returns Alarms for a list of Sites. GetAlarms(sites []*Site) ([]*Alarm, error) // GetAlarmsSite retreives the Alarms for a single Site. GetAlarmsSite(site *Site) ([]*Alarm, error) // GetAnomalies returns Anomalies for a list of Sites. GetAnomalies(sites []*Site, timeRange ...time.Time) ([]*Anomaly, error) // GetAnomaliesSite retreives the Anomalies for a single Site. GetAnomaliesSite(site *Site, timeRange ...time.Time) ([]*Anomaly, error) // GetClients returns a response full of clients' data from the UniFi Controller. GetClients(sites []*Site) ([]*Client, error) // GetClientsDPI garners dpi data for clients. GetClientsDPI(sites []*Site) ([]*DPITable, error) // GetDevices returns a response full of devices' data from the UniFi Controller. GetDevices(sites []*Site) (*Devices, error) // GetUSWs returns all switches, an error, or nil if there are no switches. GetUSWs(site *Site) ([]*USW, error) // GetUAPs returns all access points, an error, or nil if there are no APs. GetUAPs(site *Site) ([]*UAP, error) // GetUDMs returns all dream machines, an error, or nil if there are no UDMs. GetUDMs(site *Site) ([]*UDM, error) // GetUXGs returns all 10Gb gateways, an error, or nil if there are no UXGs. GetUXGs(site *Site) ([]*UXG, error) // GetUSGs returns all 1Gb gateways, an error, or nil if there are no USGs. GetUSGs(site *Site) ([]*USG, error) // GetEvents returns a response full of UniFi Events for the last 1 hour from multiple sites. GetEvents(sites []*Site, hours time.Duration) ([]*Event, error) // GetSiteEvents retrieves the last 1 hour's worth of events from a single site. GetSiteEvents(site *Site, hours time.Duration) ([]*Event, error) // GetIDS returns Intrusion Detection Systems events for a list of Sites. // timeRange may have a length of 0, 1 or 2. The first time is Start, the second is End. // Events between start and end are returned. End defaults to time.Now(). GetIDS(sites []*Site, timeRange ...time.Time) ([]*IDS, error) // GetIDSSite retrieves the Intrusion Detection System Data for a single Site. // timeRange may have a length of 0, 1 or 2. The first time is Start, the second is End. // Events between start and end are returned. End defaults to time.Now(). GetIDSSite(site *Site, timeRange ...time.Time) ([]*IDS, error) // GetNetworks returns a response full of network data from the UniFi Controller. GetNetworks(sites []*Site) ([]Network, error) // GetSites returns a list of configured sites on the UniFi controller. GetSites() ([]*Site, error) // GetSiteDPI garners dpi data for sites. GetSiteDPI(sites []*Site) ([]*DPITable, error) // GetRogueAPs returns RogueAPs for a list of Sites. // Use GetRogueAPsSite if you want more control. GetRogueAPs(sites []*Site) ([]*RogueAP, error) // GetRogueAPsSite returns RogueAPs for a single Site. GetRogueAPsSite(site *Site) ([]*RogueAP, error) // Login is a helper method. It can be called to grab a new authentication cookie. Login() error // Logout closes the current session. Logout() error // GetServerData sets the controller's version and UUID. Only call this if you // previously called Login and suspect the controller version has changed. GetServerData() (*ServerStatus, error) // GetUsers returns a response full of clients that connected to the UDM within the provided amount of time // using the insight historical connection data set. GetUsers(sites []*Site, hours int) ([]*User, error) }
type Uplink ¶
type Uplink struct { BytesR FlexInt `json:"bytes-r"` Drops FlexInt `json:"drops"` Enable FlexBool `json:"enable,omitempty"` FullDuplex FlexBool `json:"full_duplex"` Gateways []string `fakesize:"5" json:"gateways,omitempty"` IP string `fake:"{ipv4address}" json:"ip"` Latency FlexInt `json:"latency"` Mac string `json:"mac,omitempty"` MaxSpeed FlexInt `json:"max_speed"` Media string `json:"media"` Name string `fake:"{animal}" json:"name"` Nameservers []string `json:"nameservers"` Netmask string `json:"netmask"` NumPort FlexInt `json:"num_port"` PortIdx FlexInt `json:"port_idx"` 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"` RxRate FlexInt `json:"rx_rate"` Speed FlexInt `json:"speed"` SpeedtestLastrun FlexInt `json:"speedtest_lastrun,omitempty"` SpeedtestPing FlexInt `json:"speedtest_ping,omitempty"` SpeedtestStatus string `json:"speedtest_status,omitempty"` TxBytes FlexInt `json:"tx_bytes"` TxBytesR FlexInt `json:"tx_bytes-r"` TxDropped FlexInt `json:"tx_dropped"` TxErrors FlexInt `json:"tx_errors"` TxPackets FlexInt `json:"tx_packets"` TxRate FlexInt `json:"tx_rate"` Type string `json:"type"` Up FlexBool `json:"up"` Uptime FlexInt `json:"uptime"` XputDown FlexInt `json:"xput_down,omitempty"` XputUp FlexInt `json:"xput_up,omitempty"` }
Uplink is the Internet connection (or uplink) on a UniFi device.
type UptimeStats ¶
type UptimeStats struct { Availability FlexInt `json:"availability"` LatencyAverage FlexInt `json:"latency_average"` TimePeriod FlexInt `json:"time_period"` }
UptimeStats is incuded with certain devices.
type User ¶
type User struct { Blocked FlexBool `json:"blocked,omitempty"` DevIDOverride FlexInt `json:"dev_id_override,omitempty"` Duration FlexInt `json:"duration,omitempty"` FingerprintOverride FlexBool `json:"fingerprint_override,omitempty"` FirstSeen FlexInt `json:"first_seen,omitempty"` FixedIp string `fake:"{ipv4address}" json:"fixed_ip,omitempty"` //nolint:revive Hostname string `json:"hostname,omitempty"` ID string `fake:"{uuid}" json:"_id"` IsGuest bool `json:"is_guest"` IsWired bool `json:"is_wired,omitempty"` LastSeen FlexInt `json:"last_seen,omitempty"` Mac string `fake:"{macaddress}" json:"mac"` Name string `fake:"{animal}" json:"name,omitempty"` Note string `fake:"{buzzword}" json:"note,omitempty"` Noted FlexBool `json:"noted,omitempty"` Oui string `json:"oui,omitempty"` RxBytes FlexInt `json:"rx_bytes,omitempty"` RxPackets FlexInt `json:"rx_packets,omitempty"` SiteID string `fake:"{uuid}" json:"site_id"` SiteName string `json:"-"` SourceName string `json:"-"` TxBytes FlexInt `json:"tx_bytes,omitempty"` TxPackets FlexInt `json:"tx_packets,omitempty"` TxRetries FlexInt `json:"tx_retries,omitempty"` UseFixedIp FlexBool `json:"use_fixedip,omitempty"` //nolint:revive UsergroupID string `json:"usergroup_id,omitempty"` WifiTxAttempts FlexInt `json:"wifi_tx_attempts,omitempty"` }
User defines the metadata available for previously connected clients.
type VapTable ¶
type VapTable []struct { AnomaliesBarChart struct { HighDNSLatency FlexInt `json:"high_dns_latency"` HighTCPLatency FlexInt `json:"high_tcp_latency"` HighTCPPacketLoss FlexInt `json:"high_tcp_packet_loss"` HighWifiLatency FlexInt `json:"high_wifi_latency"` HighWifiRetries FlexInt `json:"high_wifi_retries"` LowPhyRate FlexInt `json:"low_phy_rate"` PoorStreamEff FlexInt `json:"poor_stream_eff"` SleepyClient FlexInt `json:"sleepy_client"` StaArpTimeout FlexInt `json:"sta_arp_timeout"` StaDNSTimeout FlexInt `json:"sta_dns_timeout"` StaIPTimeout FlexInt `json:"sta_ip_timeout"` WeakSignal FlexInt `json:"weak_signal"` } `json:"anomalies_bar_chart"` AnomaliesBarChartNow struct { HighDNSLatency FlexInt `json:"high_dns_latency"` HighTCPLatency FlexInt `json:"high_tcp_latency"` HighTCPPacketLoss FlexInt `json:"high_tcp_packet_loss"` HighWifiLatency FlexInt `json:"high_wifi_latency"` HighWifiRetries FlexInt `json:"high_wifi_retries"` LowPhyRate FlexInt `json:"low_phy_rate"` PoorStreamEff FlexInt `json:"poor_stream_eff"` SleepyClient FlexInt `json:"sleepy_client"` StaArpTimeout FlexInt `json:"sta_arp_timeout"` StaDNSTimeout FlexInt `json:"sta_dns_timeout"` StaIPTimeout FlexInt `json:"sta_ip_timeout"` WeakSignal FlexInt `json:"weak_signal"` } `json:"anomalies_bar_chart_now"` ApMac string `fake:"{macaddress}" json:"ap_mac"` AvgClientSignal FlexInt `json:"avg_client_signal"` Bssid string `fake:"{macaddress}" json:"bssid"` Ccq int `json:"ccq"` Channel FlexInt `json:"channel"` DNSAvgLatency FlexInt `json:"dns_avg_latency"` Essid string `fake:"{macaddress}" json:"essid"` Extchannel int `json:"extchannel"` ID string `fake:"{uuid}" json:"id"` IsGuest FlexBool `json:"is_guest"` IsWep FlexBool `json:"is_wep"` MacFilterRejections int `json:"mac_filter_rejections"` MapID interface{} `json:"map_id"` Name string `fake:"{randomstring:[foo,bar]}" json:"name"` NumSatisfactionSta FlexInt `json:"num_satisfaction_sta"` NumSta int `json:"num_sta"` Radio string `json:"radio"` RadioName string `json:"radio_name"` ReasonsBarChart struct { PhyRate FlexInt `json:"phy_rate"` Signal FlexInt `json:"signal"` SleepyClient FlexInt `json:"sleepy_client"` StaArpTimeout FlexInt `json:"sta_arp_timeout"` StaDNSLatency FlexInt `json:"sta_dns_latency"` StaDNSTimeout FlexInt `json:"sta_dns_timeout"` StaIPTimeout FlexInt `json:"sta_ip_timeout"` StreamEff FlexInt `json:"stream_eff"` TCPLatency FlexInt `json:"tcp_latency"` TCPPacketLoss FlexInt `json:"tcp_packet_loss"` WifiLatency FlexInt `json:"wifi_latency"` WifiRetries FlexInt `json:"wifi_retries"` } `json:"reasons_bar_chart"` ReasonsBarChartNow struct { PhyRate FlexInt `json:"phy_rate"` Signal FlexInt `json:"signal"` SleepyClient FlexInt `json:"sleepy_client"` StaArpTimeout FlexInt `json:"sta_arp_timeout"` StaDNSLatency FlexInt `json:"sta_dns_latency"` StaDNSTimeout FlexInt `json:"sta_dns_timeout"` StaIPTimeout FlexInt `json:"sta_ip_timeout"` StreamEff FlexInt `json:"stream_eff"` TCPLatency FlexInt `json:"tcp_latency"` TCPPacketLoss FlexInt `json:"tcp_packet_loss"` WifiLatency FlexInt `json:"wifi_latency"` WifiRetries FlexInt `json:"wifi_retries"` } `json:"reasons_bar_chart_now"` RxBytes FlexInt `json:"rx_bytes"` RxCrypts FlexInt `json:"rx_crypts"` RxDropped FlexInt `json:"rx_dropped"` RxErrors FlexInt `json:"rx_errors"` RxFrags FlexInt `json:"rx_frags"` RxNwids FlexInt `json:"rx_nwids"` RxPackets FlexInt `json:"rx_packets"` RxTCPStats struct { Goodbytes FlexInt `json:"goodbytes"` LatAvg FlexInt `json:"lat_avg"` LatMax FlexInt `json:"lat_max"` LatMin FlexInt `json:"lat_min"` Stalls FlexInt `json:"stalls"` } `json:"rx_tcp_stats"` Satisfaction FlexInt `json:"satisfaction"` SatisfactionNow FlexInt `json:"satisfaction_now"` SiteID string `fake:"{uuid}" json:"site_id"` State string `json:"state"` T string `json:"t"` TxBytes FlexInt `json:"tx_bytes"` TxCombinedRetries FlexInt `json:"tx_combined_retries"` TxDataMpduBytes FlexInt `json:"tx_data_mpdu_bytes"` TxDropped FlexInt `json:"tx_dropped"` TxErrors FlexInt `json:"tx_errors"` TxPackets FlexInt `json:"tx_packets"` TxPower FlexInt `json:"tx_power"` TxRetries FlexInt `json:"tx_retries"` TxRtsRetries FlexInt `json:"tx_rts_retries"` TxSuccess FlexInt `json:"tx_success"` TxTCPStats struct { Goodbytes FlexInt `json:"goodbytes"` LatAvg FlexInt `json:"lat_avg"` LatMax FlexInt `json:"lat_max"` LatMin FlexInt `json:"lat_min"` Stalls FlexInt `json:"stalls"` } `json:"tx_tcp_stats"` TxTotal FlexInt `json:"tx_total"` Up FlexBool `json:"up"` Usage string `json:"usage"` WifiTxAttempts FlexInt `json:"wifi_tx_attempts"` WifiTxDropped FlexInt `json:"wifi_tx_dropped"` WifiTxLatencyMov struct { Avg FlexInt `json:"avg"` Max FlexInt `json:"max"` Min FlexInt `json:"min"` Total FlexInt `json:"total"` TotalCount FlexInt `json:"total_count"` } `json:"wifi_tx_latency_mov"` WlanconfID string `json:"wlanconf_id"` }
VapTable holds much of the UAP wireless data. Shared by UDM.
type Wan ¶
type Wan struct { Autoneg FlexBool `json:"autoneg"` BytesR FlexInt `json:"bytes-r"` DNS []string `fakesize:"5" json:"dns"` // may be deprecated Enable FlexBool `json:"enable"` FlowctrlRx FlexBool `json:"flowctrl_rx"` FlowctrlTx FlexBool `json:"flowctrl_tx"` FullDuplex FlexBool `json:"full_duplex"` Gateway string `json:"gateway"` // may be deprecated IP string `fake:"{ipv4address}" json:"ip"` Ifname string `json:"ifname"` IsUplink FlexBool `json:"is_uplink"` Mac string `fake:"{macaddress}" json:"mac"` MaxSpeed FlexInt `json:"max_speed"` Media string `json:"media"` Name string `fake:"{animal}" json:"name"` Netmask string `json:"netmask"` // may be deprecated NumPort int `json:"num_port"` PortIdx int `json:"port_idx"` PortPoe FlexBool `json:"port_poe"` 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"` RxRate FlexInt `json:"rx_rate"` Speed FlexInt `json:"speed"` SpeedCaps FlexInt `json:"speed_caps"` 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"` TxRate FlexInt `json:"tx_rate"` Type string `json:"type"` Up FlexBool `fake:"{constFlexBool:true}" json:"up"` }
Wan is a Wan interface on a USG or UDM.