unifi

package module
v0.0.0-...-8053208 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 4, 2021 License: ISC Imports: 13 Imported by: 0

README

Unifi

GoDoc Build

Ubiquiti Unifi Go API

Port of https://github.com/calmh/unifi-api to Golang

A library is a work-in-progress. Far away of beeing complete. Suggestions and patches are welcome.

Documentation

Index

Constants

View Source
const (
	OpModeSwitch    = "switch" // FIXME
	OpModeAggregate = "aggregate"
	OpModeMirror    = "mirror"
)
View Source
const (
	POEModeAuto   = "auto"
	POEModeOff    = "off"
	POEModePasv24 = "pasv24"
)
View Source
const (
	TypeAccessPoint = "uap"
	TypeSwitch      = "usw"
	TypeGateway     = "ugw"
)

Variables

View Source
var (
	ErrLoginFirst = errors.New("login first")
)

Functions

This section is empty.

Types

type AlarmFilter

type AlarmFilter struct {
	Limit     int  `json:"_limit"`
	Start     int  `json:"_start"`
	Withcount bool `json:"withcount"`
	Archived  bool `json:"archived"`
}

type AllUser

type AllUser struct {
	ID         string `json:"_id"`
	Mac        string `json:"mac"`
	SiteID     string `json:"site_id"`
	Oui        string `json:"oui"`
	IsGuest    bool   `json:"is_guest"`
	FirstSeen  int64  `json:"first_seen"`
	LastSeen   int64  `json:"last_seen"`
	IsWired    bool   `json:"is_wired"`
	Hostname   string `json:"hostname,omitempty"`
	Blocked    bool   `json:"blocked,omitempty"`
	UseFixedip bool   `json:"use_fixedip,omitempty"`
	NetworkID  string `json:"network_id,omitempty"`
	FixedIP    string `json:"fixed_ip,omitempty"`
	Noted      bool   `json:"noted,omitempty"`
	// contains filtered or unexported fields
}

func (AllUser) Block

func (s AllUser) Block() error

func (AllUser) UnBlock

func (s AllUser) UnBlock() error

type Ap

type Ap struct {
	Ap                                             string    `json:"ap"`
	Bytes                                          float64   `json:"bytes"`
	Datetime                                       time.Time `json:"datetime"`
	Duration                                       float64   `json:"duration"`
	GuestRxBytes                                   float64   `json:"guest-rx_bytes"`
	GuestRxCrypts                                  float64   `json:"guest-rx_crypts"`
	GuestRxDropped                                 float64   `json:"guest-rx_dropped"`
	GuestRxErrors                                  float64   `json:"guest-rx_errors"`
	GuestRxFrags                                   float64   `json:"guest-rx_frags"`
	GuestRxPackets                                 float64   `json:"guest-rx_packets"`
	GuestTxBytes                                   float64   `json:"guest-tx_bytes"`
	GuestTxDropped                                 float64   `json:"guest-tx_dropped"`
	GuestTxErrors                                  float64   `json:"guest-tx_errors"`
	GuestTxPackets                                 float64   `json:"guest-tx_packets"`
	GuestTxRetries                                 float64   `json:"guest-tx_retries"`
	O                                              string    `json:"o"`
	Oid                                            string    `json:"oid"`
	RxBytes                                        float64   `json:"rx_bytes"`
	RxCrypts                                       float64   `json:"rx_crypts"`
	RxDropped                                      float64   `json:"rx_dropped"`
	RxErrors                                       float64   `json:"rx_errors"`
	RxFrags                                        float64   `json:"rx_frags"`
	RxPackets                                      float64   `json:"rx_packets"`
	SiteID                                         string    `json:"site_id"`
	Time                                           int64     `json:"time"`
	TxBytes                                        float64   `json:"tx_bytes"`
	TxDropped                                      float64   `json:"tx_dropped"`
	TxErrors                                       float64   `json:"tx_errors"`
	TxPackets                                      float64   `json:"tx_packets"`
	TxRetries                                      float64   `json:"tx_retries"`
	UserRxBytes                                    float64   `json:"user-rx_bytes"`
	UserRxCrypts                                   float64   `json:"user-rx_crypts"`
	UserRxDropped                                  float64   `json:"user-rx_dropped"`
	UserRxErrors                                   float64   `json:"user-rx_errors"`
	UserRxFrags                                    float64   `json:"user-rx_frags"`
	UserRxPackets                                  float64   `json:"user-rx_packets"`
	UserTxBytes                                    float64   `json:"user-tx_bytes"`
	UserTxDropped                                  float64   `json:"user-tx_dropped"`
	UserTxErrors                                   float64   `json:"user-tx_errors"`
	UserTxPackets                                  float64   `json:"user-tx_packets"`
	UserTxRetries                                  float64   `json:"user-tx_retries"`
	UserWifi0Ath05Aa99001C9E77C011Dc149F7RxBytes   float64   `json:"user-wifi0-ath0-5aa99001c9e77c011dc149f7-rx_bytes"`
	UserWifi0Ath05Aa99001C9E77C011Dc149F7RxPackets float64   `json:"user-wifi0-ath0-5aa99001c9e77c011dc149f7-rx_packets"`
	UserWifi0Ath05Aa99001C9E77C011Dc149F7TxBytes   float64   `json:"user-wifi0-ath0-5aa99001c9e77c011dc149f7-tx_bytes"`
	UserWifi0Ath05Aa99001C9E77C011Dc149F7TxPackets float64   `json:"user-wifi0-ath0-5aa99001c9e77c011dc149f7-tx_packets"`
	UserWifi0RxBytes                               float64   `json:"user-wifi0-rx_bytes"`
	UserWifi0RxCrypts                              float64   `json:"user-wifi0-rx_crypts"`
	UserWifi0RxDropped                             float64   `json:"user-wifi0-rx_dropped"`
	UserWifi0RxErrors                              float64   `json:"user-wifi0-rx_errors"`
	UserWifi0RxFrags                               float64   `json:"user-wifi0-rx_frags"`
	UserWifi0RxPackets                             float64   `json:"user-wifi0-rx_packets"`
	UserWifi0TxBytes                               float64   `json:"user-wifi0-tx_bytes"`
	UserWifi0TxDropped                             float64   `json:"user-wifi0-tx_dropped"`
	UserWifi0TxErrors                              float64   `json:"user-wifi0-tx_errors"`
	UserWifi0TxPackets                             float64   `json:"user-wifi0-tx_packets"`
	UserWifi0TxRetries                             float64   `json:"user-wifi0-tx_retries"`
	UserWifi1Ath2NullRxBytes                       float64   `json:"user-wifi1-ath2-null-rx_bytes"`
	UserWifi1Ath2NullRxPackets                     float64   `json:"user-wifi1-ath2-null-rx_packets"`
	UserWifi1Ath2NullTxBytes                       float64   `json:"user-wifi1-ath2-null-tx_bytes"`
	UserWifi1Ath2NullTxPackets                     float64   `json:"user-wifi1-ath2-null-tx_packets"`
	UserWifi1RxBytes                               float64   `json:"user-wifi1-rx_bytes"`
	UserWifi1RxCrypts                              float64   `json:"user-wifi1-rx_crypts"`
	UserWifi1RxDropped                             float64   `json:"user-wifi1-rx_dropped"`
	UserWifi1RxErrors                              float64   `json:"user-wifi1-rx_errors"`
	UserWifi1RxFrags                               float64   `json:"user-wifi1-rx_frags"`
	UserWifi1RxPackets                             float64   `json:"user-wifi1-rx_packets"`
	UserWifi1TxBytes                               float64   `json:"user-wifi1-tx_bytes"`
	UserWifi1TxDropped                             float64   `json:"user-wifi1-tx_dropped"`
	UserWifi1TxErrors                              float64   `json:"user-wifi1-tx_errors"`
	UserWifi1TxPackets                             float64   `json:"user-wifi1-tx_packets"`
	UserWifi1TxRetries                             float64   `json:"user-wifi1-tx_retries"`
	Wifi0RxBytes                                   float64   `json:"wifi0-rx_bytes"`
	Wifi0RxCrypts                                  float64   `json:"wifi0-rx_crypts"`
	Wifi0RxDropped                                 float64   `json:"wifi0-rx_dropped"`
	Wifi0RxErrors                                  float64   `json:"wifi0-rx_errors"`
	Wifi0RxFrags                                   float64   `json:"wifi0-rx_frags"`
	Wifi0RxPackets                                 float64   `json:"wifi0-rx_packets"`
	Wifi0TxBytes                                   float64   `json:"wifi0-tx_bytes"`
	Wifi0TxDropped                                 float64   `json:"wifi0-tx_dropped"`
	Wifi0TxErrors                                  float64   `json:"wifi0-tx_errors"`
	Wifi0TxPackets                                 float64   `json:"wifi0-tx_packets"`
	Wifi0TxRetries                                 float64   `json:"wifi0-tx_retries"`
	Wifi1RxBytes                                   float64   `json:"wifi1-rx_bytes"`
	Wifi1RxCrypts                                  float64   `json:"wifi1-rx_crypts"`
	Wifi1RxDropped                                 float64   `json:"wifi1-rx_dropped"`
	Wifi1RxErrors                                  float64   `json:"wifi1-rx_errors"`
	Wifi1RxFrags                                   float64   `json:"wifi1-rx_frags"`
	Wifi1RxPackets                                 float64   `json:"wifi1-rx_packets"`
	Wifi1TxBytes                                   float64   `json:"wifi1-tx_bytes"`
	Wifi1TxDropped                                 float64   `json:"wifi1-tx_dropped"`
	Wifi1TxErrors                                  float64   `json:"wifi1-tx_errors"`
	Wifi1TxPackets                                 float64   `json:"wifi1-tx_packets"`
	Wifi1TxRetries                                 float64   `json:"wifi1-tx_retries"`
}

type BasicEvent

type BasicEvent struct {
	Archived       *bool     `json:"archived,omitempty"`         // Alarm field
	HandledAdminID string    `json:"handled_admin_id,omitempty"` // Alarm field
	HandledTime    time.Time `json:"handled_time,omitempty"`     // Alarm field	ID        string `json:"_id"`
	ID             string    `json:"_id"`
	Datetime       time.Time
	Key            string `json:"key"`
	Message        string `json:"msg"`
	Time           int64  `json:"time"`
}

type Bytes

type Bytes float64

func (Bytes) String

func (b Bytes) String() string

type ConfigNetwork

type ConfigNetwork struct {
	IP   string
	Type string
}

type ConfigNetworkWan

type ConfigNetworkWan struct {
	DNS1    string `json:"dns1"`
	DNS2    string `json:"dns2"`
	Gateway string `json:"gateway"`
	IP      string `json:"ip"`
	Netmask string `json:"netmask"`
	Type    string `json:"type"`
}

type DevState

type DevState int
const (
	Disconnected     DevState = 0
	Connected        DevState = 1
	Pending          DevState = 2
	Disconnecting    DevState = 3
	Upgrading        DevState = 4
	Provisioning     DevState = 5
	HeartbeatMissing DevState = 6
	Adopting         DevState = 7
	Deleting         DevState = 8
	ManagedByOthers  DevState = 9
	AdoptionFailed   DevState = 10
	Isolated         DevState = 11
	IsolationPending DevState = 12
	AdoptingWireless DevState = 13
)

func (DevState) String

func (i DevState) String() string

type Device

type Device struct {
	ID string `json:"_id"`
	//Uptime             int           `json:"_uptime"`
	Adopted          bool          `json:"adopted"`
	AntennaTable     []interface{} `json:"antenna_table,omitempty"`
	Bytes            int           `json:"bytes"`
	BytesD           int           `json:"bytes-d,omitempty"`
	BytesR           int           `json:"bytes-r,omitempty"`
	Cfgversion       string        `json:"cfgversion"`
	ConfigNetwork    ConfigNetwork `json:"config_network"`
	ConnectRequestIP string        `json:"connect_request_ip"`
	//ConnectRequestPort int           `json:"connect_request_port"` //FIXME: Prior to 5.7.20 type string!
	ConsideredLostAt int           `json:"considered_lost_at"`
	DeviceID         string        `json:"device_id"`
	EthernetTable    []Ethernet    `json:"ethernet_table"`
	FwCaps           int           `json:"fw_caps"`
	GuestNumSta      int           `json:"guest-num_sta"`
	GuestToken       string        `json:"guest_token,omitempty"`
	HasEth1          bool          `json:"has_eth1,omitempty"`
	HasSpeaker       bool          `json:"has_speaker,omitempty"`
	InformIP         string        `json:"inform_ip"`
	InformURL        string        `json:"inform_url"`
	IP               string        `json:"ip"`
	Isolated         bool          `json:"isolated,omitempty"`
	KnownCfgversion  string        `json:"known_cfgversion"`
	LastSeen         int           `json:"last_seen"`
	LedOverride      string        `json:"led_override"`
	LicenseState     string        `json:"license_state"`
	Locating         bool          `json:"locating"`
	Mac              string        `json:"mac"`
	MapID            string        `json:"map_id,omitempty"`
	Model            string        `json:"model"`
	Name             string        `json:"name"`
	NextHeartbeatAt  int           `json:"next_heartbeat_at"`
	NumSta           int           `json:"num_sta"`
	PortStats        []interface{} `json:"port_stats,omitempty"`
	PortTable        []Port        `json:"port_table"`
	RadioTable       []struct {
		BuiltinAntGain     int    `json:"builtin_ant_gain"`
		BuiltinAntenna     bool   `json:"builtin_antenna"`
		CurrentAntennaGain int    `json:"current_antenna_gain"`
		MaxTxpower         int    `json:"max_txpower"`
		MinTxpower         int    `json:"min_txpower"`
		Name               string `json:"name"`
		Nss                int    `json:"nss"`
		Radio              string `json:"radio"`
		RadioCaps          int    `json:"radio_caps"`
		WlangroupID        string `json:"wlangroup_id"`
	} `json:"radio_table,omitempty"`
	RadioTableStats []struct {
		AstBeXmit   interface{} `json:"ast_be_xmit"`
		AstCst      interface{} `json:"ast_cst"`
		AstTxto     interface{} `json:"ast_txto"`
		Channel     int         `json:"channel"`
		CuSelfRx    int         `json:"cu_self_rx"`
		CuSelfTx    int         `json:"cu_self_tx"`
		CuTotal     int         `json:"cu_total"`
		Extchannel  int         `json:"extchannel"`
		Gain        int         `json:"gain"`
		GuestNumSta int         `json:"guest-num_sta"`
		Name        string      `json:"name"`
		NumSta      int         `json:"num_sta"`
		Radio       string      `json:"radio"`
		State       string      `json:"state"`
		TxPackets   int         `json:"tx_packets"`
		TxPower     int         `json:"tx_power"`
		TxRetries   int         `json:"tx_retries"`
		UserNumSta  int         `json:"user-num_sta"`
	} `json:"radio_table_stats,omitempty"`
	RxBytes           int           `json:"rx_bytes"`
	RxBytesD          int           `json:"rx_bytes-d,omitempty"`
	ScanRadioTable    []interface{} `json:"scan_radio_table,omitempty"`
	Scanning          bool          `json:"scanning,omitempty"`
	Serial            string        `json:"serial"`
	SiteID            string        `json:"site_id"`
	SpectrumScanning  bool          `json:"spectrum_scanning,omitempty"`
	SSHSessionTable   []interface{} `json:"ssh_session_table,omitempty"`
	Stat              Stat          `json:"stat"`
	State             DevState      `json:"state"`
	SysStats          SysStats      `json:"sys_stats"`
	SystemStats       SystemStats   `json:"system-stats"`
	TxBytes           int           `json:"tx_bytes"`
	TxBytesD          int           `json:"tx_bytes-d,omitempty"`
	Type              string        `json:"type"`
	Upgradable        bool          `json:"upgradable"`
	UpgradeState      int           `json:"upgrade_state"`
	UpgradeToFirmware string        `json:"upgrade_to_firmware"`
	Uplink            Uplink        `json:"uplink"`
	UplinkTable       []interface{} `json:"uplink_table,omitempty"`
	Uptime            int           `json:"uptime"`
	UserNumSta        int           `json:"user-num_sta"`
	VapTable          []struct {
		ApMac      string `json:"ap_mac"`
		Bssid      string `json:"bssid"`
		Ccq        int    `json:"ccq"`
		Channel    int    `json:"channel"`
		Essid      string `json:"essid"`
		ID         string `json:"id"`
		IsGuest    bool   `json:"is_guest"`
		IsWep      bool   `json:"is_wep"`
		MapID      string `json:"map_id"`
		Name       string `json:"name"`
		NumSta     int    `json:"num_sta"`
		Radio      string `json:"radio"`
		RadioName  string `json:"radio_name"`
		RxBytes    int    `json:"rx_bytes"`
		RxCrypts   int    `json:"rx_crypts"`
		RxDropped  int    `json:"rx_dropped"`
		RxErrors   int    `json:"rx_errors"`
		RxFrags    int    `json:"rx_frags"`
		RxNwids    int    `json:"rx_nwids"`
		RxPackets  int    `json:"rx_packets"`
		SiteID     string `json:"site_id"`
		State      string `json:"state"`
		T          string `json:"t"`
		TxBytes    int    `json:"tx_bytes"`
		TxDropped  int    `json:"tx_dropped"`
		TxErrors   int    `json:"tx_errors"`
		TxPackets  int    `json:"tx_packets"`
		TxPower    int    `json:"tx_power"`
		TxRetries  int    `json:"tx_retries"`
		Up         bool   `json:"up"`
		Usage      string `json:"usage"`
		WlanconfID string `json:"wlanconf_id"`
	} `json:"vap_table,omitempty"`
	Version                string           `json:"version"`
	VersionIncompatible    bool             `json:"version_incompatible"`
	VwireEnabled           bool             `json:"vwireEnabled,omitempty"`
	VwireTable             []interface{}    `json:"vwire_table,omitempty"`
	VwireVapTable          []interface{}    `json:"vwire_vap_table,omitempty"`
	WifiCaps               int              `json:"wifi_caps,omitempty"`
	X                      fuzzyFloat       `json:"x,omitempty"`
	XAuthkey               string           `json:"x_authkey"`
	XFingerprint           string           `json:"x_fingerprint"`
	XHasSSHHostkey         bool             `json:"x_has_ssh_hostkey"`
	XInformAuthkey         string           `json:"x_inform_authkey"`
	XSSHHostkeyFingerprint string           `json:"x_ssh_hostkey_fingerprint"`
	XVwirekey              string           `json:"x_vwirekey,omitempty"`
	Y                      fuzzyFloat       `json:"y,omitempty"`
	DhcpServerTable        []interface{}    `json:"dhcp_server_table,omitempty"`
	Dot1XPortctrlEnabled   bool             `json:"dot1x_portctrl_enabled,omitempty"`
	FlowctrlEnabled        bool             `json:"flowctrl_enabled,omitempty"`
	GeneralTemperature     int              `json:"general_temperature,omitempty"`
	HasFan                 bool             `json:"has_fan,omitempty"`
	HasTemperature         bool             `json:"has_temperature,omitempty"`
	JumboframeEnabled      bool             `json:"jumboframe_enabled,omitempty"`
	Overheating            bool             `json:"overheating,omitempty"`
	StpPriority            string           `json:"stp_priority,omitempty"`
	StpVersion             string           `json:"stp_version,omitempty"`
	UplinkDepth            int              `json:"uplink_depth,omitempty"`
	ConfigNetworkWan       ConfigNetworkWan `json:"config_network_wan,omitempty"`
	ConfigNetworkWan2      ConfigNetworkWan `json:"config_network_wan2,omitempty"`
	NetworkTable           []interface{}    `json:"network_table,omitempty"`
	NumDesktop             int              `json:"num_desktop,omitempty"`
	NumHandheld            int              `json:"num_handheld,omitempty"`
	NumMobile              int              `json:"num_mobile,omitempty"`
	SpeedtestStatus        struct {
		Latency        float64 `json:"latency"` // NOTE: Prior to 5.8 type string
		Rundate        int     `json:"rundate"`
		Runtime        int     `json:"runtime"`
		StatusDownload int     `json:"status_download"`
		StatusPing     int     `json:"status_ping"`
		StatusSummary  int     `json:"status_summary"`
		StatusUpload   int     `json:"status_upload"`
		XputDownload   float64 `json:"xput_download"`
		XputUpload     float64 `json:"xput_upload"`
	} `json:"speedtest-status,omitempty"`
	SpeedtestStatusSaved bool           `json:"speedtest-status-saved,omitempty"`
	UsgCaps              int            `json:"usg_caps,omitempty"`
	Wan1                 Wan            `json:"wan1,omitempty"`
	Wan2                 Wan            `json:"waWann2,omitempty"`
	PortOverrides        []PortOverride `json:"port_overrides"`
	// contains filtered or unexported fields
}

func (Device) DeviceName

func (d Device) DeviceName() string

func (Device) ModelName

func (d Device) ModelName() string

type DeviceMap

type DeviceMap map[string]Device

type DownlinkTable

type DownlinkTable struct {
}

type EVT_AD_Login

type EVT_AD_Login struct {
	Archived       *bool     `json:"archived,omitempty"`         // Alarm field
	HandledAdminID string    `json:"handled_admin_id,omitempty"` // Alarm field
	HandledTime    time.Time `json:"handled_time,omitempty"`     // Alarm field
	ID             string    `json:"_id"`
	Admin          string    `json:"admin"`
	Datetime       time.Time `json:"datetime"`
	IP             string    `json:"ip"`
	IsAdmin        bool      `json:"is_admin"`
	Key            string    `json:"key"`
	Msg            string    `json:"msg"`
	SiteID         string    `json:"site_id"`
	Subsystem      string    `json:"subsystem"`
	Time           int64     `json:"time"`
}

type EVT_AP_Adopted

type EVT_AP_Adopted struct {
	Archived       *bool     `json:"archived,omitempty"`         // Alarm field
	HandledAdminID string    `json:"handled_admin_id,omitempty"` // Alarm field
	HandledTime    time.Time `json:"handled_time,omitempty"`     // Alarm field
	ID             string    `json:"_id"`
	Admin          string    `json:"admin"`
	Ap             string    `json:"ap"`
	ApName         string    `json:"ap_name"`
	Datetime       time.Time `json:"datetime"`
	IsAdmin        bool      `json:"is_admin"`
	Key            string    `json:"key"`
	Msg            string    `json:"msg"`
	SiteID         string    `json:"site_id"`
	Subsystem      string    `json:"subsystem"`
	Time           int64     `json:"time"`
}

type EVT_AP_Connected

type EVT_AP_Connected struct {
	Archived       *bool     `json:"archived,omitempty"`         // Alarm field
	HandledAdminID string    `json:"handled_admin_id,omitempty"` // Alarm field
	HandledTime    time.Time `json:"handled_time,omitempty"`     // Alarm field
	ID             string    `json:"_id"`
	Ap             string    `json:"ap"`
	ApName         string    `json:"ap_name"`
	Datetime       time.Time `json:"datetime"`
	Key            string    `json:"key"`
	Msg            string    `json:"msg"`
	SiteID         string    `json:"site_id"`
	Subsystem      string    `json:"subsystem"`
	Time           int64     `json:"time"`
}

type EVT_AP_DetectRogueAP

type EVT_AP_DetectRogueAP struct {
	Archived       *bool     `json:"archived,omitempty"`         // Alarm field
	HandledAdminID string    `json:"handled_admin_id,omitempty"` // Alarm field
	HandledTime    time.Time `json:"handled_time,omitempty"`     // Alarm field
	ID             string    `json:"_id"`
	Datetime       time.Time `json:"datetime"`
	Essid          string    `json:"essid"`
	Key            string    `json:"key"`
	Mac            string    `json:"mac"`
	Msg            string    `json:"msg"`
	SiteID         string    `json:"site_id"`
	Subsystem      string    `json:"subsystem"`
	Time           int64     `json:"time"`
}

type EVT_AP_DiscoveredPending

type EVT_AP_DiscoveredPending struct {
	Archived       *bool     `json:"archived,omitempty"`         // Alarm field
	HandledAdminID string    `json:"handled_admin_id,omitempty"` // Alarm field
	HandledTime    time.Time `json:"handled_time,omitempty"`     // Alarm field
	ID             string    `json:"_id"`
	Ap             string    `json:"ap"`
	ApName         string    `json:"ap_name"`
	Datetime       time.Time `json:"datetime"`
	Key            string    `json:"key"`
	Msg            string    `json:"msg"`
	SiteID         string    `json:"site_id"`
	Subsystem      string    `json:"subsystem"`
	Time           int64     `json:"time"`
}

type EVT_AP_Isolated

type EVT_AP_Isolated struct {
	Archived       *bool     `json:"archived,omitempty"`         // Alarm field
	HandledAdminID string    `json:"handled_admin_id,omitempty"` // Alarm field
	HandledTime    time.Time `json:"handled_time,omitempty"`     // Alarm field
	ID             string    `json:"_id"`
	Ap             string    `json:"ap"`
	Datetime       time.Time `json:"datetime"`
	Key            string    `json:"key"`
	Msg            string    `json:"msg"`
	SiteID         string    `json:"site_id"`
	Subsystem      string    `json:"subsystem"`
	Time           int64     `json:"time"`
}

type EVT_AP_Lost_Contact

type EVT_AP_Lost_Contact struct {
	Archived       *bool     `json:"archived,omitempty"`         // Alarm field
	HandledAdminID string    `json:"handled_admin_id,omitempty"` // Alarm field
	HandledTime    time.Time `json:"handled_time,omitempty"`     // Alarm field
	ID             string    `json:"_id"`
	Ap             string    `json:"ap"`
	ApName         string    `json:"ap_name"`
	Datetime       time.Time `json:"datetime"`
	Key            string    `json:"key"`
	Msg            string    `json:"msg"`
	SiteID         string    `json:"site_id"`
	Subsystem      string    `json:"subsystem"`
	Time           int64     `json:"time"`
}

type EVT_AP_PossibleInterference

type EVT_AP_PossibleInterference struct {
	Archived       *bool     `json:"archived,omitempty"`         // Alarm field
	HandledAdminID string    `json:"handled_admin_id,omitempty"` // Alarm field
	HandledTime    time.Time `json:"handled_time,omitempty"`     // Alarm field
	ID             string    `json:"_id"`
	Ap             string    `json:"ap"`
	Channel        string    `json:"channel"`
	Datetime       time.Time `json:"datetime"`
	Key            string    `json:"key"`
	Msg            string    `json:"msg"`
	Radio          string    `json:"radio"`
	SiteID         string    `json:"site_id"`
	Subsystem      string    `json:"subsystem"`
	Time           int64     `json:"time"`
}

type EVT_AP_Restarted

type EVT_AP_Restarted struct {
	Archived       *bool     `json:"archived,omitempty"`         // Alarm field
	HandledAdminID string    `json:"handled_admin_id,omitempty"` // Alarm field
	HandledTime    time.Time `json:"handled_time,omitempty"`     // Alarm field
	ID             string    `json:"_id"`
	Admin          string    `json:"admin"`
	Ap             string    `json:"ap"`
	ApName         string    `json:"ap_name"`
	Datetime       time.Time `json:"datetime"`
	IsAdmin        bool      `json:"is_admin"`
	Key            string    `json:"key"`
	Msg            string    `json:"msg"`
	SiteID         string    `json:"site_id"`
	Subsystem      string    `json:"subsystem"`
	Time           int64     `json:"time"`
}

type EVT_AP_RestartedUnknown

type EVT_AP_RestartedUnknown struct {
	Archived       *bool     `json:"archived,omitempty"`         // Alarm field
	HandledAdminID string    `json:"handled_admin_id,omitempty"` // Alarm field
	HandledTime    time.Time `json:"handled_time,omitempty"`     // Alarm field
	ID             string    `json:"_id"`
	Ap             string    `json:"ap"`
	ApName         string    `json:"ap_name"`
	Datetime       time.Time `json:"datetime"`
	Duration       int       `json:"duration"`
	Key            string    `json:"key"`
	Msg            string    `json:"msg"`
	NumSta         int       `json:"num_sta"`
	SiteID         string    `json:"site_id"`
	Subsystem      string    `json:"subsystem"`
	Time           int64     `json:"time"`
}

type EVT_AP_UpgradeScheduled

type EVT_AP_UpgradeScheduled struct {
	Archived       *bool     `json:"archived,omitempty"`         // Alarm field
	HandledAdminID string    `json:"handled_admin_id,omitempty"` // Alarm field
	HandledTime    time.Time `json:"handled_time,omitempty"`     // Alarm field
	ID             string    `json:"_id"`
	Admin          string    `json:"admin"`
	Ap             string    `json:"ap"`
	ApName         string    `json:"ap_name"`
	Datetime       time.Time `json:"datetime"`
	IsAdmin        bool      `json:"is_admin"`
	Key            string    `json:"key"`
	Msg            string    `json:"msg"`
	SiteID         string    `json:"site_id"`
	Subsystem      string    `json:"subsystem"`
	Time           int64     `json:"time"`
}

type EVT_AP_Upgraded

type EVT_AP_Upgraded struct {
	Archived       *bool     `json:"archived,omitempty"`         // Alarm field
	HandledAdminID string    `json:"handled_admin_id,omitempty"` // Alarm field
	HandledTime    time.Time `json:"handled_time,omitempty"`     // Alarm field
	ID             string    `json:"_id"`
	Ap             string    `json:"ap"`
	ApName         string    `json:"ap_name"`
	Datetime       time.Time `json:"datetime"`
	Key            string    `json:"key"`
	Msg            string    `json:"msg"`
	SiteID         string    `json:"site_id"`
	Subsystem      string    `json:"subsystem"`
	Time           int64     `json:"time"`
	VersionFrom    string    `json:"version_from"`
	VersionTo      string    `json:"version_to"`
}

type EVT_LU_Connected

type EVT_LU_Connected struct {
	Archived       *bool     `json:"archived,omitempty"`         // Alarm field
	HandledAdminID string    `json:"handled_admin_id,omitempty"` // Alarm field
	HandledTime    time.Time `json:"handled_time,omitempty"`     // Alarm field
	ID             string    `json:"_id"`
	Datetime       time.Time `json:"datetime"`
	Key            string    `json:"key"`
	Msg            string    `json:"msg"`
	Network        string    `json:"network"`
	SiteID         string    `json:"site_id"`
	Subsystem      string    `json:"subsystem"`
	Time           int64     `json:"time"`
	User           string    `json:"user"`
}

type EVT_LU_Disconnected

type EVT_LU_Disconnected struct {
	Archived       *bool     `json:"archived,omitempty"`         // Alarm field
	HandledAdminID string    `json:"handled_admin_id,omitempty"` // Alarm field
	HandledTime    time.Time `json:"handled_time,omitempty"`     // Alarm field
	ID             string    `json:"_id"`
	Bytes          int       `json:"bytes"`
	Datetime       time.Time `json:"datetime"`
	Duration       int       `json:"duration"`
	Key            string    `json:"key"`
	Msg            string    `json:"msg"`
	Network        string    `json:"network"`
	SiteID         string    `json:"site_id"`
	Subsystem      string    `json:"subsystem"`
	Time           int64     `json:"time"`
	User           string    `json:"user"`
}

type EVT_SW_Adopted

type EVT_SW_Adopted struct {
	Archived       *bool     `json:"archived,omitempty"`         // Alarm field
	HandledAdminID string    `json:"handled_admin_id,omitempty"` // Alarm field
	HandledTime    time.Time `json:"handled_time,omitempty"`     // Alarm field
	ID             string    `json:"_id"`
	Admin          string    `json:"admin"`
	Datetime       time.Time `json:"datetime"`
	IsAdmin        bool      `json:"is_admin"`
	Key            string    `json:"key"`
	Msg            string    `json:"msg"`
	SiteID         string    `json:"site_id"`
	Subsystem      string    `json:"subsystem"`
	Sw             string    `json:"sw"`
	SwName         string    `json:"sw_name"`
	Time           int64     `json:"time"`
}

type EVT_SW_Connected

type EVT_SW_Connected struct {
	Archived       *bool     `json:"archived,omitempty"`         // Alarm field
	HandledAdminID string    `json:"handled_admin_id,omitempty"` // Alarm field
	HandledTime    time.Time `json:"handled_time,omitempty"`     // Alarm field
	ID             string    `json:"_id"`
	Datetime       time.Time `json:"datetime"`
	Key            string    `json:"key"`
	Msg            string    `json:"msg"`
	SiteID         string    `json:"site_id"`
	Subsystem      string    `json:"subsystem"`
	Sw             string    `json:"sw"`
	SwName         string    `json:"sw_name"`
	Time           int64     `json:"time"`
}

type EVT_SW_DiscoveredPending

type EVT_SW_DiscoveredPending struct {
	Archived       *bool     `json:"archived,omitempty"`         // Alarm field
	HandledAdminID string    `json:"handled_admin_id,omitempty"` // Alarm field
	HandledTime    time.Time `json:"handled_time,omitempty"`     // Alarm field
	ID             string    `json:"_id"`
	Datetime       time.Time `json:"datetime"`
	Key            string    `json:"key"`
	Msg            string    `json:"msg"`
	SiteID         string    `json:"site_id"`
	Subsystem      string    `json:"subsystem"`
	Sw             string    `json:"sw"`
	SwName         string    `json:"sw_name"`
	Time           int64     `json:"time"`
}

type EVT_SW_Lost_Contact

type EVT_SW_Lost_Contact struct {
	Archived       *bool     `json:"archived,omitempty"`         // Alarm field
	HandledAdminID string    `json:"handled_admin_id,omitempty"` // Alarm field
	HandledTime    time.Time `json:"handled_time,omitempty"`     // Alarm field
	ID             string    `json:"_id"`
	Datetime       time.Time `json:"datetime"`
	Key            string    `json:"key"`
	Msg            string    `json:"msg"`
	SiteID         string    `json:"site_id"`
	Subsystem      string    `json:"subsystem"`
	Sw             string    `json:"sw"`
	SwName         string    `json:"sw_name"`
	Time           int64     `json:"time"`
}

type EVT_SW_PoeDisconnect

type EVT_SW_PoeDisconnect struct {
	Archived       *bool     `json:"archived,omitempty"`         // Alarm field
	HandledAdminID string    `json:"handled_admin_id,omitempty"` // Alarm field
	HandledTime    time.Time `json:"handled_time,omitempty"`     // Alarm field
	ID             string    `json:"_id"`
	Datetime       time.Time `json:"datetime"`
	Key            string    `json:"key"`
	Msg            string    `json:"msg"`
	Port           int       `json:"port"`
	SiteID         string    `json:"site_id"`
	Subsystem      string    `json:"subsystem"`
	Sw             string    `json:"sw"`
	SwName         string    `json:"sw_name"`
	Time           int64     `json:"time"`
}

EVT_SW_PoeDisconnect controller version 5.8.21+ / USW firmware 3.9.27+

type EVT_SW_RestartedUnknown

type EVT_SW_RestartedUnknown struct {
	Archived       *bool     `json:"archived,omitempty"`         // Alarm field
	HandledAdminID string    `json:"handled_admin_id,omitempty"` // Alarm field
	HandledTime    time.Time `json:"handled_time,omitempty"`     // Alarm field
	ID             string    `json:"_id"`
	Datetime       time.Time `json:"datetime"`
	Key            string    `json:"key"`
	Msg            string    `json:"msg"`
	SiteID         string    `json:"site_id"`
	Subsystem      string    `json:"subsystem"`
	Sw             string    `json:"sw"`
	SwName         string    `json:"sw_name"`
	Time           int64     `json:"time"`
}

type EVT_SW_UpgradeScheduled

type EVT_SW_UpgradeScheduled struct {
	Archived       *bool     `json:"archived,omitempty"`         // Alarm field
	HandledAdminID string    `json:"handled_admin_id,omitempty"` // Alarm field
	HandledTime    time.Time `json:"handled_time,omitempty"`     // Alarm field
	ID             string    `json:"_id"`
	Admin          string    `json:"admin"`
	Datetime       time.Time `json:"datetime"`
	IsAdmin        bool      `json:"is_admin"`
	Key            string    `json:"key"`
	Msg            string    `json:"msg"`
	SiteID         string    `json:"site_id"`
	Subsystem      string    `json:"subsystem"`
	Sw             string    `json:"sw"`
	SwName         string    `json:"sw_name"`
	Time           int64     `json:"time"`
}

type EVT_SW_Upgraded

type EVT_SW_Upgraded struct {
	Archived       *bool     `json:"archived,omitempty"`         // Alarm field
	HandledAdminID string    `json:"handled_admin_id,omitempty"` // Alarm field
	HandledTime    time.Time `json:"handled_time,omitempty"`     // Alarm field
	ID             string    `json:"_id"`
	Datetime       time.Time `json:"datetime"`
	Key            string    `json:"key"`
	Msg            string    `json:"msg"`
	SiteID         string    `json:"site_id"`
	Subsystem      string    `json:"subsystem"`
	Sw             string    `json:"sw"`
	SwName         string    `json:"sw_name"`
	Time           int64     `json:"time"`
	VersionFrom    string    `json:"version_from"`
	VersionTo      string    `json:"version_to"`
}

type EVT_WU_Connected

type EVT_WU_Connected struct {
	Archived       *bool     `json:"archived,omitempty"`         // Alarm field
	HandledAdminID string    `json:"handled_admin_id,omitempty"` // Alarm field
	HandledTime    time.Time `json:"handled_time,omitempty"`     // Alarm field
	ID             string    `json:"_id"`
	Ap             string    `json:"ap"`
	Channel        string    `json:"channel"`
	Datetime       time.Time `json:"datetime"`
	Hostname       string    `json:"hostname"`
	Key            string    `json:"key"`
	Msg            string    `json:"msg"`
	Radio          string    `json:"radio"`
	SiteID         string    `json:"site_id"`
	Ssid           string    `json:"ssid"`
	Subsystem      string    `json:"subsystem"`
	Time           int64     `json:"time"`
	User           string    `json:"user"`
}

type EVT_WU_Disconnected

type EVT_WU_Disconnected struct {
	Archived       *bool     `json:"archived,omitempty"`         // Alarm field
	HandledAdminID string    `json:"handled_admin_id,omitempty"` // Alarm field
	HandledTime    time.Time `json:"handled_time,omitempty"`     // Alarm field
	ID             string    `json:"_id"`
	Ap             string    `json:"ap"`
	Bytes          int       `json:"bytes"`
	Datetime       time.Time `json:"datetime"`
	Duration       int       `json:"duration"`
	Hostname       string    `json:"hostname"`
	Key            string    `json:"key"`
	Msg            string    `json:"msg"`
	SiteID         string    `json:"site_id"`
	Ssid           string    `json:"ssid"`
	Subsystem      string    `json:"subsystem"`
	Time           int64     `json:"time"`
	User           string    `json:"user"`
}

type EVT_WU_Roam

type EVT_WU_Roam struct {
	Archived       *bool     `json:"archived,omitempty"`         // Alarm field
	HandledAdminID string    `json:"handled_admin_id,omitempty"` // Alarm field
	HandledTime    time.Time `json:"handled_time,omitempty"`     // Alarm field
	ID             string    `json:"_id"`
	ApFrom         string    `json:"ap_from"`
	ApTo           string    `json:"ap_to"`
	Channel        string    `json:"channel"`
	ChannelFrom    string    `json:"channel_from"`
	ChannelTo      string    `json:"channel_to"`
	Datetime       time.Time `json:"datetime"`
	Key            string    `json:"key"`
	Msg            string    `json:"msg"`
	Radio          string    `json:"radio"`
	RadioFrom      string    `json:"radio_from"`
	RadioTo        string    `json:"radio_to"`
	SiteID         string    `json:"site_id"`
	Ssid           string    `json:"ssid"`
	Subsystem      string    `json:"subsystem"`
	Time           int64     `json:"time"`
	User           string    `json:"user"`
}

type EVT_WU_RoamRadio

type EVT_WU_RoamRadio struct {
	Archived       *bool     `json:"archived,omitempty"`         // Alarm field
	HandledAdminID string    `json:"handled_admin_id,omitempty"` // Alarm field
	HandledTime    time.Time `json:"handled_time,omitempty"`     // Alarm field
	ID             string    `json:"_id"`
	Ap             string    `json:"ap"`
	ChannelFrom    string    `json:"channel_from"`
	ChannelTo      string    `json:"channel_to"`
	Datetime       time.Time `json:"datetime"`
	Key            string    `json:"key"`
	Msg            string    `json:"msg"`
	RadioFrom      string    `json:"radio_from"`
	RadioTo        string    `json:"radio_to"`
	SiteID         string    `json:"site_id"`
	Subsystem      string    `json:"subsystem"`
	Time           int64     `json:"time"`
	User           string    `json:"user"`
}

type Ethernet

type Ethernet struct {
	Mac     string
	Name    string
	NumPort *int `json:"num_port"` // Pointer to check if absent
}

type EventFilter

type EventFilter struct {
	Limit  int `json:"_limit"`
	Start  int `json:"_start"`
	Within int `json:"within"`
}

type Health

type Health struct {
	LAN  LAN
	VPN  VPN
	WAN  WAN
	WLAN WLAN
	WWW  WWW
}

type LAN

type LAN struct {
	LanIP           string `json:"lan_ip"`
	NumAdopted      int    `json:"num_adopted"`
	NumDisconnected int    `json:"num_disconnected"`
	NumGuest        int    `json:"num_guest"`
	NumPending      int    `json:"num_pending"`
	NumSw           int    `json:"num_sw"`
	NumUser         int    `json:"num_user"`
	RxBytesR        int    `json:"rx_bytes-r"`
	Status          string `json:"status"`
	Subsystem       string `json:"subsystem"`
	TxBytesR        int    `json:"tx_bytes-r"`
}

type Network

type Network struct {
	ID                string `json:"_id"`
	AttrHiddenID      string `json:"attr_hidden_id"`
	AttrNoDelete      bool   `json:"attr_no_delete"`
	DhcpdEnabled      bool   `json:"dhcpd_enabled"`
	DhcpdStart        string `json:"dhcpd_start"`
	DhcpdStop         string `json:"dhcpd_stop"`
	Dhcpdv6Enabled    bool   `json:"dhcpdv6_enabled"`
	DomainName        string `json:"domain_name"`
	IPSubnet          string `json:"ip_subnet"`
	Ipv6InterfaceType string `json:"ipv6_interface_type"`
	Ipv6RaEnabled     bool   `json:"ipv6_ra_enabled"`
	IsNat             bool   `json:"is_nat"`
	Name              string `json:"name"`
	Networkgroup      string `json:"networkgroup"`
	Purpose           string `json:"purpose"`
	SiteID            string `json:"site_id"`
	VlanEnabled       bool   `json:"vlan_enabled"`
}

UniFi Network object

type NetworkMap

type NetworkMap map[string]Network

A map of UniFi Networks with a given attribute as key

type NewVoucher

type NewVoucher struct {
	Cmd          string `json:"cmd"`
	Expire       string `json:"expire"`
	ExpireNumber string `json:"expire_number"`
	ExpireUnit   string `json:"expire_unit"`
	N            string `json:"n"`
	Note         string `json:"note"`
	Quota        string `json:"quota"`
}
var Nv NewVoucher

Value with parameters for create New Voucher

type Port

type Port struct {
	AggregatedBy   interface{} `json:"aggregated_by"` // FIXME: type false or int (5.6.22)
	Autoneg        bool
	BytesR         int64  `json:"bytes-r"`
	Dot1xMode      string `json:"dot1x_mode"`
	Dot1xStatus    string `json:"dot1x_status"`
	Enable         bool
	FlowCtrl       bool `json:"flowctrl_tx"`
	FlowCtrlRx     bool `json:"flowctrl_rx"`
	FullDuplex     bool `json:"full_duplex"`
	IsUplink       bool `json:"is_uplink"`
	Jumbo          bool
	Masked         bool
	Media          string
	Name           string `json:"name"`
	OpMode         string `json:"op_mode"`
	PoeCaps        int    `json:"poe_caps"`
	PoeClass       string `json:"poe_class"`
	PoeCurrent     string `json:"poe_current"`
	PoeEnabled     bool   `json:"poe_enable"`
	PoeGood        bool   `json:"poe_good"`
	PoeMode        string `json:"poe_mode"`
	PoePower       string `json:"poe_power"`
	PoeVoltage     string `json:"poe_voltage"`
	PortIdx        int    `json:"port_idx"`
	PortPoe        bool   `json:"port_poe"`
	PortconfID     string `json:"portconf_id"`
	RxBroadcast    int64  `json:"rx_broadcast"`
	RxBytes        int64  `json:"rx_bytes"`
	RxBytesR       int64  `json:"rx_bytes-r"`
	RxDropped      int64  `json:"rx_dropped"`
	RxErrors       int64  `json:"rx_errors"`
	RxMulticast    int64  `json:"rx_multicast"`
	RxPackets      int64  `json:"rx_packets"`
	Speed          int
	SfpCompliance  string `json:"sfp_compliance"`
	SfpCurrent     string `json:"sfp_current"`
	SfpFound       bool   `json:"sfp_found"`
	SfpPart        string `json:"sfp_part"`
	SfpRevision    string `json:"sfp_rev"`
	SfpRxFault     bool   `json:"sfp_rxfault"`
	SfpRxPower     string `json:"sfp_rxpower"`
	SfpSerial      string `json:"sfp_serial"`
	SfpTemperature string `json:"sfp_temperature"`
	SfpTxFault     bool   `json:"sfp_txfault"`
	SfpTxPower     string `json:"sfp_txpower"`
	SfpVendor      string `json:"sfp_vendor"`
	SfpVoltage     string `json:"sfp_voltage"`
	StpPathcost    int64  `json:"stp_pathcost"`
	StpState       string `json:"stp_state"`
	TxBroadcast    int64  `json:"tx_broadcast"`
	TxMulticast    int64  `json:"tx_multicast"`
	TxBytes        int64  `json:"tx_bytes"`
	TxBytesR       int64  `json:"tx_bytes-r"`
	TxDropped      int64  `json:"tx_dropped"`
	TxErrors       int64  `json:"tx_errors"`
	TxPackets      int64  `json:"tx_packets"`
	Up             bool
}

type PortOverride

type PortOverride struct {
	AggregateNumPorts        *int   `json:"aggregate_num_ports,omitempty"`
	Autoneg                  *bool  `json:"autoneg,omitempty"`
	FullDuplex               *bool  `json:"full_duplex,omitempty"`
	Isolation                *bool  `json:"isolation,omitempty"`
	LLDPMedEnabled           *bool  `json:"lldpmed_enabled,omitempty"`
	MirrorPortIdx            string `json:"mirror_port_idx,omitempty"`
	Name                     string `json:"name,omitempty"`
	OpMode                   string `json:"op_mode,omitempty"`  // Values (switching(absent)|aggregate\mirror )
	POEMode                  string `json:"poe_mode,omitempty"` // Values ('auto'|'off'|'pasv24')
	PortIdx                  int    `json:"port_idx"`
	PortconfID               string `json:"portconf_id"`
	Speed                    *int   `json:"speed,omitempty"`
	StormcontrolBcastEnabled *bool  `json:"stormctrl_bcast_enabled,omitempty"`
	StormcontrolBcastRate    *int   `json:"stormctrl_bcast_rate,omitempty"`
	StormcontrolMcastEnabled *bool  `json:"stormctrl_mcast_enabled,omitempty"`
	StormcontrolMcastRate    *int   `json:"stormctrl_mcast_rate,omitempty"`
	StormcontrolUcastEnabled *bool  `json:"stormctrl_ucast_enabled,omitempty"`
	StormcontrolUcastRate    *int   `json:"stormctrl_ucast_rate,omitempty"`
}

type PortProfile

type PortProfile struct {
	ID                   string   `json:"_id"`
	AttrHidden           bool     `json:"attr_hidden,omitempty"`
	AttrHiddenID         string   `json:"attr_hidden_id,omitempty"`
	AttrNoDelete         bool     `json:"attr_no_delete,omitempty"`
	AttrNoEdit           bool     `json:"attr_no_edit,omitempty"`
	Forward              string   `json:"forward"`
	Name                 string   `json:"name"`
	SiteID               string   `json:"site_id"`
	NativeNetworkconfID  string   `json:"native_networkconf_id,omitempty"`
	Autoneg              bool     `json:"autoneg,omitempty"`
	Dot1XCtrl            string   `json:"dot1x_ctrl,omitempty"`
	LldpmedEnabled       bool     `json:"lldpmed_enabled,omitempty"`
	OpMode               string   `json:"op_mode,omitempty"`
	TaggedNetworkconfIds []string `json:"tagged_networkconf_ids,omitempty"`
}

type PortprofileMap

type PortprofileMap map[string]PortProfile

type RadioTableStats

type RadioTableStats struct {
	AstBeXmit   interface{} `json:"ast_be_xmit"`
	AstCst      interface{} `json:"ast_cst"`
	AstTxto     interface{} `json:"ast_txto"`
	Channel     int         `json:"channel"`
	CuSelfRx    int         `json:"cu_self_rx"`
	CuSelfTx    int         `json:"cu_self_tx"`
	CuTotal     int         `json:"cu_total"`
	Extchannel  int         `json:"extchannel"`
	Gain        int         `json:"gain"`
	GuestNumSta int         `json:"guest-num_sta"`
	Name        string      `json:"name"`
	NumSta      int         `json:"num_sta"`
	Radio       string      `json:"radio"`
	State       string      `json:"state"`
	TxPackets   int         `json:"tx_packets"`
	TxPower     int         `json:"tx_power"`
	TxRetries   int         `json:"tx_retries"`
	UserNumSta  int         `json:"user-num_sta"`
}

type RawAlarm

type RawAlarm struct {
	Data json.RawMessage
	Key  string
}

type RawDevice

type RawDevice struct {
	Data json.RawMessage
	Type string
}

type RawEvent

type RawEvent struct {
	Data json.RawMessage
	Key  string
}

type STP

type STP int
const (
	StpDisabled   STP = 0
	StpBlocking   STP = 1
	StpListening  STP = 2
	StpLearning   STP = 3
	StpForwarding STP = 4
	StpUnknown    STP = 9
)

Spanning-Tree states

func (STP) String

func (i STP) String() string

type Site

type Site struct {
	ID           string `json:"_id"` // For internal use
	AttrHiddenID string `json:"attr_hidden_id"`
	AttrNoDelete bool   `json:"attr_no_delete"`
	Desc         string // The name of the site! (Friendly name)
	Name         string // The site-id!
	Role         string
}

UniFi Site object

type Sta

type Sta struct {
	ID               string `json:"_id"`
	IsGuestByUsw     bool   `json:"_is_guest_by_usw,omitempty"`
	LastSeenByUsw    int    `json:"_last_seen_by_usw,omitempty"`
	UptimeByUsw      int    `json:"_uptime_by_usw,omitempty"`
	AssocTime        int    `json:"assoc_time"`
	FirstSeen        int64  `json:"first_seen"`
	IP               string `json:"ip"`
	IsGuest          bool   `json:"is_guest"`
	IsWired          bool   `json:"is_wired"`
	LastSeen         int64  `json:"last_seen"`
	LatestAssocTime  int    `json:"latest_assoc_time"`
	Mac              string `json:"mac"`
	Network          string `json:"network,omitempty"`
	NetworkID        string `json:"network_id,omitempty"`
	Oui              string `json:"oui"`
	SiteID           string `json:"site_id"`
	SwDepth          int    `json:"sw_depth,omitempty"`
	SwMac            string `json:"sw_mac,omitempty"`
	SwPort           int    `json:"sw_port,omitempty"`
	Uptime           int    `json:"uptime"`
	UserID           string `json:"user_id"`
	Hostname         string `json:"hostname,omitempty"`
	IsGuestByUap     bool   `json:"_is_guest_by_uap,omitempty"`
	LastSeenByUap    int    `json:"_last_seen_by_uap,omitempty"`
	RoamCount        int    `json:"roam_count,omitempty"`
	UptimeByUap      int    `json:"_uptime_by_uap,omitempty"`
	ApMac            string `json:"ap_mac,omitempty"`
	Authorized       bool   `json:"authorized,omitempty"`
	BSSID            string `json:"bssid,omitempty"`
	BytesR           int    `json:"bytes-r,omitempty"`
	Ccq              int    `json:"ccq,omitempty"`
	Channel          int    `json:"channel,omitempty"`
	ESSID            string `json:"essid,omitempty"`
	Idletime         int    `json:"idletime,omitempty"`
	Is11R            bool   `json:"is_11r,omitempty"`
	Noise            int    `json:"noise,omitempty"`
	PowersaveEnabled bool   `json:"powersave_enabled,omitempty"`
	QosPolicyApplied bool   `json:"qos_policy_applied,omitempty"`
	Radio            string `json:"radio,omitempty"`
	RadioProto       string `json:"radio_proto,omitempty"`
	Rssi             int    `json:"rssi,omitempty"`
	RxBytes          int    `json:"rx_bytes,omitempty"`
	RxBytesR         int    `json:"rx_bytes-r,omitempty"`
	RxPackets        int    `json:"rx_packets,omitempty"`
	RxRate           int    `json:"rx_rate,omitempty"`
	Signal           int    `json:"signal,omitempty"`
	TxBytes          int    `json:"tx_bytes,omitempty"`
	TxBytesR         int    `json:"tx_bytes-r,omitempty"`
	TxPackets        int    `json:"tx_packets,omitempty"`
	TxPower          int    `json:"tx_power,omitempty"`
	TxRate           int    `json:"tx_rate,omitempty"`
	Vlan             int    `json:"vlan,omitempty"`
	// contains filtered or unexported fields
}

Station data

func (Sta) AuthorizeGuest

func (s Sta) AuthorizeGuest(minutes int) error

func (Sta) Block

func (s Sta) Block() error

func (Sta) Disconnect

func (s Sta) Disconnect() error

func (Sta) Name

func (s Sta) Name() string

Returns a station name

func (Sta) UnBlock

func (s Sta) UnBlock() error

func (Sta) UnauthorizeGuest

func (s Sta) UnauthorizeGuest() error

type StaMap

type StaMap map[string]Sta

type StaTable

type StaTable struct {
	AuthTime      int `json:"auth_time"`
	Authorized    bool
	Ccq           int
	DhcpendTime   int `json:"dhcpend_time"`
	DhcpstartTime int `json:"dhcpstart_time"`
	Hostname      string
	Idletime      int
	IP            string
	Is11b         bool `json:"is_11b"`
	Is11n         bool `json:"is_11n"`
	Mac           string
	Noise         int
	Rssi          int
	RxBytes       int `json:"rx_bytes"`
	RxPackets     int `json:"rx_packets"`
	RxRate        int `json:"rx_rate"`
	Signal        int
	State         int
	StateHt       bool `json:"state_ht"`
	StatePwrmgt   bool `json:"state_pwrmgt"`
	TxBytes       int  `json:"tx_bytes"`
	TxPackets     int  `json:"tx_packets"`
	TxPower       int  `json:"tx_power"`
	TxRate        int  `json:"tx_rate"`
	Uptime        int
}

type Stat

type Stat struct {
	Ap Ap `json:"ap"`
}

API version 5.12.35

type SysStats

type SysStats struct {
	MemBuffer int    `json:"mem_buffer"`
	MemUsed   int    `json:"mem_used"`
	LoadAvg1  string `json:"loadavg_1"`
	LoadAvg5  string `json:"loadavg_5"`
	LoadAvg15 string `json:"loadavg_15"`
	MemTotal  int    `json:"mem_total"`
}

type SystemStats

type SystemStats struct {
	SystemStats struct {
		CPU   string `json:"cpu"`
		Mem   string `json:"mem"`
		Temps struct {
			BoardCPU string `json:"Board (CPU)"`
			BoardPHY string `json:"Board (PHY)"`
			CPU      string `json:"CPU"`
			PHY      string `json:"PHY"`
		} `json:"temps"`
	} `json:"system-stats"`
}

type Timestamp

type Timestamp time.Time

func (Timestamp) String

func (t Timestamp) String() string

func (*Timestamp) UnmarshalJSON

func (t *Timestamp) UnmarshalJSON(b []byte) error

type UAP

type UAP struct {
	ID string `json:"_id"`
	//Uptime        int           `json:"_uptime"`
	Adopted       bool          `json:"adopted"`
	AntennaTable  []interface{} `json:"antenna_table"`
	Bytes         int           `json:"bytes"`
	BytesD        int           `json:"bytes-d"`
	BytesR        int           `json:"bytes-r"`
	Cfgversion    string        `json:"cfgversion"`
	ConfigNetwork struct {
		IP   string `json:"ip"`
		Type string `json:"type"`
	} `json:"config_network"`
	ConnectRequestIP string `json:"connect_request_ip"`
	//ConnectRequestPort int           `json:"connect_request_port"` //FIXME: Prior to 5.7.20 type string!
	ConsideredLostAt int           `json:"considered_lost_at"`
	DeviceID         string        `json:"device_id"`
	DownlinkTable    []interface{} `json:"downlink_table"`
	EthernetTable    []struct {
		Mac     string `json:"mac"`
		Name    string `json:"name"`
		NumPort int    `json:"num_port"`
	} `json:"ethernet_table"`
	FwCaps          int    `json:"fw_caps"`
	GuestNumSta     int    `json:"guest-num_sta"`
	GuestToken      string `json:"guest_token"`
	HasEth1         bool   `json:"has_eth1"`
	HasSpeaker      bool   `json:"has_speaker"`
	InformIP        string `json:"inform_ip"`
	InformURL       string `json:"inform_url"`
	IP              string `json:"ip"`
	Isolated        bool   `json:"isolated"`
	KnownCfgversion string `json:"known_cfgversion"`
	LastSeen        int    `json:"last_seen"`
	LedOverride     string `json:"led_override"`
	LicenseState    string `json:"license_state"`
	Locating        bool   `json:"locating"`

	Mac   string `json:"mac"`
	MapID string `json:"map_id"`
	Model string `json:"model"`

	Name            string        `json:"name"`
	NextHeartbeatAt int           `json:"next_heartbeat_at"`
	NumSta          int           `json:"num_sta"`
	PortStats       []interface{} `json:"port_stats"`
	PortTable       []Port        `json:"port_table,omitempty"`
	RadioTable      []struct {
		BuiltinAntGain     int    `json:"builtin_ant_gain"`
		BuiltinAntenna     bool   `json:"builtin_antenna"`
		CurrentAntennaGain int    `json:"current_antenna_gain"`
		MaxTxpower         int    `json:"max_txpower"`
		MinTxpower         int    `json:"min_txpower"`
		Name               string `json:"name"`
		Nss                int    `json:"nss"`
		Radio              string `json:"radio"`
		RadioCaps          int    `json:"radio_caps"`
		WlangroupID        string `json:"wlangroup_id"`
		HasDfs             bool   `json:"has_dfs,omitempty"`
		HasFccdfs          bool   `json:"has_fccdfs,omitempty"`
		Is11Ac             bool   `json:"is_11ac,omitempty"`
	} `json:"radio_table"`
	RadioTableStats []struct {
		AstBeXmit   interface{} `json:"ast_be_xmit"`
		AstCst      interface{} `json:"ast_cst"`
		AstTxto     interface{} `json:"ast_txto"`
		Channel     int         `json:"channel"`
		CuSelfRx    int         `json:"cu_self_rx"`
		CuSelfTx    int         `json:"cu_self_tx"`
		CuTotal     int         `json:"cu_total"`
		Extchannel  int         `json:"extchannel"`
		Gain        int         `json:"gain"`
		GuestNumSta int         `json:"guest-num_sta"`
		Name        string      `json:"name"`
		NumSta      int         `json:"num_sta"`
		Radio       string      `json:"radio"`
		State       string      `json:"state"`
		TxPackets   int         `json:"tx_packets"`
		TxPower     int         `json:"tx_power"`
		TxRetries   int         `json:"tx_retries"`
		UserNumSta  int         `json:"user-num_sta"`
	} `json:"radio_table_stats"`

	RxBytes          int           `json:"rx_bytes"`
	RxBytesD         int           `json:"rx_bytes-d"`
	ScanRadioTable   []interface{} `json:"scan_radio_table"`
	Scanning         bool          `json:"scanning"`
	Serial           string        `json:"serial"`
	SiteID           string        `json:"site_id"`
	SpectrumScanning bool          `json:"spectrum_scanning"`
	SSHSessionTable  []interface{} `json:"ssh_session_table"`
	Stat             struct {
		Ap struct {
			Ap                                             string    `json:"ap"`
			Bytes                                          float64   `json:"bytes"`
			Datetime                                       time.Time `json:"datetime"`
			Duration                                       float64   `json:"duration"`
			GuestRxBytes                                   float64   `json:"guest-rx_bytes"`
			GuestRxCrypts                                  float64   `json:"guest-rx_crypts"`
			GuestRxDropped                                 float64   `json:"guest-rx_dropped"`
			GuestRxErrors                                  float64   `json:"guest-rx_errors"`
			GuestRxFrags                                   float64   `json:"guest-rx_frags"`
			GuestRxPackets                                 float64   `json:"guest-rx_packets"`
			GuestTxBytes                                   float64   `json:"guest-tx_bytes"`
			GuestTxDropped                                 float64   `json:"guest-tx_dropped"`
			GuestTxErrors                                  float64   `json:"guest-tx_errors"`
			GuestTxPackets                                 float64   `json:"guest-tx_packets"`
			GuestTxRetries                                 float64   `json:"guest-tx_retries"`
			O                                              string    `json:"o"`
			Oid                                            string    `json:"oid"`
			RxBytes                                        float64   `json:"rx_bytes"`
			RxCrypts                                       float64   `json:"rx_crypts"`
			RxDropped                                      float64   `json:"rx_dropped"`
			RxErrors                                       float64   `json:"rx_errors"`
			RxFrags                                        float64   `json:"rx_frags"`
			RxPackets                                      float64   `json:"rx_packets"`
			SiteID                                         string    `json:"site_id"`
			Time                                           int64     `json:"time"`
			TxBytes                                        float64   `json:"tx_bytes"`
			TxDropped                                      float64   `json:"tx_dropped"`
			TxErrors                                       float64   `json:"tx_errors"`
			TxPackets                                      float64   `json:"tx_packets"`
			TxRetries                                      float64   `json:"tx_retries"`
			UserRxBytes                                    float64   `json:"user-rx_bytes"`
			UserRxCrypts                                   float64   `json:"user-rx_crypts"`
			UserRxDropped                                  float64   `json:"user-rx_dropped"`
			UserRxErrors                                   float64   `json:"user-rx_errors"`
			UserRxFrags                                    float64   `json:"user-rx_frags"`
			UserRxPackets                                  float64   `json:"user-rx_packets"`
			UserTxBytes                                    float64   `json:"user-tx_bytes"`
			UserTxDropped                                  float64   `json:"user-tx_dropped"`
			UserTxErrors                                   float64   `json:"user-tx_errors"`
			UserTxPackets                                  float64   `json:"user-tx_packets"`
			UserTxRetries                                  float64   `json:"user-tx_retries"`
			UserWifi0Ath05Aa99001C9E77C011Dc149F7RxBytes   float64   `json:"user-wifi0-ath0-5aa99001c9e77c011dc149f7-rx_bytes"`
			UserWifi0Ath05Aa99001C9E77C011Dc149F7RxPackets float64   `json:"user-wifi0-ath0-5aa99001c9e77c011dc149f7-rx_packets"`
			UserWifi0Ath05Aa99001C9E77C011Dc149F7TxBytes   float64   `json:"user-wifi0-ath0-5aa99001c9e77c011dc149f7-tx_bytes"`
			UserWifi0Ath05Aa99001C9E77C011Dc149F7TxPackets float64   `json:"user-wifi0-ath0-5aa99001c9e77c011dc149f7-tx_packets"`
			UserWifi0RxBytes                               float64   `json:"user-wifi0-rx_bytes"`
			UserWifi0RxCrypts                              float64   `json:"user-wifi0-rx_crypts"`
			UserWifi0RxDropped                             float64   `json:"user-wifi0-rx_dropped"`
			UserWifi0RxErrors                              float64   `json:"user-wifi0-rx_errors"`
			UserWifi0RxFrags                               float64   `json:"user-wifi0-rx_frags"`
			UserWifi0RxPackets                             float64   `json:"user-wifi0-rx_packets"`
			UserWifi0TxBytes                               float64   `json:"user-wifi0-tx_bytes"`
			UserWifi0TxDropped                             float64   `json:"user-wifi0-tx_dropped"`
			UserWifi0TxErrors                              float64   `json:"user-wifi0-tx_errors"`
			UserWifi0TxPackets                             float64   `json:"user-wifi0-tx_packets"`
			UserWifi0TxRetries                             float64   `json:"user-wifi0-tx_retries"`
			UserWifi1Ath2NullRxBytes                       float64   `json:"user-wifi1-ath2-null-rx_bytes"`
			UserWifi1Ath2NullRxPackets                     float64   `json:"user-wifi1-ath2-null-rx_packets"`
			UserWifi1Ath2NullTxBytes                       float64   `json:"user-wifi1-ath2-null-tx_bytes"`
			UserWifi1Ath2NullTxPackets                     float64   `json:"user-wifi1-ath2-null-tx_packets"`
			UserWifi1RxBytes                               float64   `json:"user-wifi1-rx_bytes"`
			UserWifi1RxCrypts                              float64   `json:"user-wifi1-rx_crypts"`
			UserWifi1RxDropped                             float64   `json:"user-wifi1-rx_dropped"`
			UserWifi1RxErrors                              float64   `json:"user-wifi1-rx_errors"`
			UserWifi1RxFrags                               float64   `json:"user-wifi1-rx_frags"`
			UserWifi1RxPackets                             float64   `json:"user-wifi1-rx_packets"`
			UserWifi1TxBytes                               float64   `json:"user-wifi1-tx_bytes"`
			UserWifi1TxDropped                             float64   `json:"user-wifi1-tx_dropped"`
			UserWifi1TxErrors                              float64   `json:"user-wifi1-tx_errors"`
			UserWifi1TxPackets                             float64   `json:"user-wifi1-tx_packets"`
			UserWifi1TxRetries                             float64   `json:"user-wifi1-tx_retries"`
			Wifi0RxBytes                                   float64   `json:"wifi0-rx_bytes"`
			Wifi0RxCrypts                                  float64   `json:"wifi0-rx_crypts"`
			Wifi0RxDropped                                 float64   `json:"wifi0-rx_dropped"`
			Wifi0RxErrors                                  float64   `json:"wifi0-rx_errors"`
			Wifi0RxFrags                                   float64   `json:"wifi0-rx_frags"`
			Wifi0RxPackets                                 float64   `json:"wifi0-rx_packets"`
			Wifi0TxBytes                                   float64   `json:"wifi0-tx_bytes"`
			Wifi0TxDropped                                 float64   `json:"wifi0-tx_dropped"`
			Wifi0TxErrors                                  float64   `json:"wifi0-tx_errors"`
			Wifi0TxPackets                                 float64   `json:"wifi0-tx_packets"`
			Wifi0TxRetries                                 float64   `json:"wifi0-tx_retries"`
			Wifi1RxBytes                                   float64   `json:"wifi1-rx_bytes"`
			Wifi1RxCrypts                                  float64   `json:"wifi1-rx_crypts"`
			Wifi1RxDropped                                 float64   `json:"wifi1-rx_dropped"`
			Wifi1RxErrors                                  float64   `json:"wifi1-rx_errors"`
			Wifi1RxFrags                                   float64   `json:"wifi1-rx_frags"`
			Wifi1RxPackets                                 float64   `json:"wifi1-rx_packets"`
			Wifi1TxBytes                                   float64   `json:"wifi1-tx_bytes"`
			Wifi1TxDropped                                 float64   `json:"wifi1-tx_dropped"`
			Wifi1TxErrors                                  float64   `json:"wifi1-tx_errors"`
			Wifi1TxPackets                                 float64   `json:"wifi1-tx_packets"`
			Wifi1TxRetries                                 float64   `json:"wifi1-tx_retries"`
		} `json:"at"`
	} `json:"stat"`
	State    DevState `json:"state"`
	SysStats struct {
	} `json:"sys_stats"`
	SystemStats struct {
	} `json:"system-stats"`
	TxBytes           int    `json:"tx_bytes"`
	TxBytesD          int    `json:"tx_bytes-d"`
	Type              string `json:"type"`
	Upgradable        bool   `json:"upgradable"`
	UpgradeState      int    `json:"upgrade_state"`
	UpgradeToFirmware string `json:"upgrade_to_firmware"`
	Uplink            struct {
		FullDuplex  bool   `json:"full_duplex"`
		IP          string `json:"ip"`
		Mac         string `json:"mac"`
		MaxSpeed    int    `json:"max_speed"`
		Name        string `json:"name"`
		Netmask     string `json:"netmask"`
		NumPort     int    `json:"num_port"`
		RxBytes     int64  `json:"rx_bytes"`
		RxBytesR    int    `json:"rx_bytes-r"`
		RxDropped   int    `json:"rx_dropped"`
		RxErrors    int    `json:"rx_errors"`
		RxMulticast int    `json:"rx_multicast"`
		RxPackets   int    `json:"rx_packets"`
		Speed       int    `json:"speed"`
		TxBytes     int64  `json:"tx_bytes"`
		TxBytesR    int    `json:"tx_bytes-r"`
		TxDropped   int    `json:"tx_dropped"`
		TxErrors    int    `json:"tx_errors"`
		TxPackets   int    `json:"tx_packets"`
		Type        string `json:"type"`
		Up          bool   `json:"up"`
	} `json:"uplink"`
	UplinkTable []interface{} `json:"uplink_table"`
	Uptime      int           `json:"uptime"`
	UserNumSta  int           `json:"user-num_sta"`
	VapTable    []struct {
		ApMac      string `json:"ap_mac"`
		Bssid      string `json:"bssid"`
		Ccq        int    `json:"ccq"`
		Channel    int    `json:"channel"`
		Essid      string `json:"essid"`
		ID         string `json:"id"`
		IsGuest    bool   `json:"is_guest"`
		IsWep      bool   `json:"is_wep"`
		MapID      string `json:"map_id"`
		Name       string `json:"name"`
		NumSta     int    `json:"num_sta"`
		Radio      string `json:"radio"`
		RadioName  string `json:"radio_name"`
		RxBytes    int    `json:"rx_bytes"`
		RxCrypts   int    `json:"rx_crypts"`
		RxDropped  int    `json:"rx_dropped"`
		RxErrors   int    `json:"rx_errors"`
		RxFrags    int    `json:"rx_frags"`
		RxNwids    int    `json:"rx_nwids"`
		RxPackets  int    `json:"rx_packets"`
		SiteID     string `json:"site_id"`
		State      string `json:"state"`
		T          string `json:"t"`
		TxBytes    int    `json:"tx_bytes"`
		TxDropped  int    `json:"tx_dropped"`
		TxErrors   int    `json:"tx_errors"`
		TxPackets  int    `json:"tx_packets"`
		TxPower    int    `json:"tx_power"`
		TxRetries  int    `json:"tx_retries"`
		Up         bool   `json:"up"`
		Usage      string `json:"usage"`
		WlanconfID string `json:"wlanconf_id"`
	} `json:"vap_table"`
	Version                string        `json:"version"`
	VersionIncompatible    bool          `json:"version_incompatible"`
	VwireEnabled           bool          `json:"vwireEnabled"`
	VwireTable             []interface{} `json:"vwire_table"`
	VwireVapTable          []interface{} `json:"vwire_vap_table"`
	WifiCaps               int           `json:"wifi_caps"`
	X                      fuzzyFloat    `json:"x"`
	XAuthkey               string        `json:"x_authkey"`
	XFingerprint           string        `json:"x_fingerprint"`
	XHasSSHHostkey         bool          `json:"x_has_ssh_hostkey"`
	XInformAuthkey         string        `json:"x_inform_authkey"`
	XSSHHostkeyFingerprint string        `json:"x_ssh_hostkey_fingerprint"`
	XVwirekey              string        `json:"x_vwirekey"`
	Y                      fuzzyFloat    `json:"y"`
	// contains filtered or unexported fields
}

Access point data

func (UAP) DeviceName

func (a UAP) DeviceName() string

func (UAP) ModelName

func (a UAP) ModelName() string

func (UAP) Restart

func (a UAP) Restart() error

Reboot access point

type UAPmap

type UAPmap map[string]UAP

type USW

type USW struct {
	ID string `json:"_id"`
	//Uptime        int    `json:"_uptime"`
	Adopted       bool    `json:"adopted"`
	Bytes         float64 `json:"bytes"`
	Cfgversion    string  `json:"cfgversion"`
	ConfigNetwork struct {
		IP   string `json:"ip"`
		Type string `json:"type"`
	} `json:"config_network"`
	ConnectRequestIP string `json:"connect_request_ip"`
	//ConnectRequestPort int           `json:"connect_request_port"` //FIXME: Prior to 5.7.20 type string!
	ConsideredLostAt     int           `json:"considered_lost_at"`
	DeviceID             string        `json:"device_id"`
	DhcpServerTable      []interface{} `json:"dhcp_server_table"`
	Dot1XPortctrlEnabled bool          `json:"dot1x_portctrl_enabled"`
	DownlinkTable        []interface{} `json:"downlink_table"`
	EthernetTable        []struct {
		Mac     string `json:"mac"`
		Name    string `json:"name"`
		NumPort int    `json:"num_port,omitempty"`
	} `json:"ethernet_table"`
	FlowctrlEnabled    bool           `json:"flowctrl_enabled"`
	FwCaps             int            `json:"fw_caps"`
	GeneralTemperature int            `json:"general_temperature"`
	GuestNumSta        int            `json:"guest-num_sta"`
	HasFan             bool           `json:"has_fan"`
	HasTemperature     bool           `json:"has_temperature"`
	InformIP           string         `json:"inform_ip"`
	InformURL          string         `json:"inform_url"`
	IP                 string         `json:"ip"`
	JumboframeEnabled  bool           `json:"jumboframe_enabled"`
	KnownCfgversion    string         `json:"known_cfgversion"`
	LastSeen           int            `json:"last_seen"`
	LedOverride        string         `json:"led_override"`
	LicenseState       string         `json:"license_state"`
	Locating           bool           `json:"locating"`
	Mac                string         `json:"mac"`
	Model              string         `json:"model"`
	Name               string         `json:"name"`
	NextHeartbeatAt    int            `json:"next_heartbeat_at"`
	NumSta             int            `json:"num_sta"`
	Overheating        bool           `json:"overheating"`
	PortOverrides      []PortOverride `json:"port_overrides,omitempty"`
	PortTable          []Port         `json:"port_table"`
	RxBytes            int64          `json:"rx_bytes"`
	Serial             string         `json:"serial"`
	SiteID             string         `json:"site_id"`
	SSHSessionTable    []interface{}  `json:"ssh_session_table"`
	Stat               struct {
		Bytes    float64   `json:"bytes"`
		Datetime time.Time `json:"datetime"`
		Duration float64   `json:"duration"`
		O        string    `json:"o"`
		Oid      string    `json:"oid"`
		//Port1RxBytes   float64     `json:"port_1-rx_bytes"`
		//Port1RxPackets int       `json:"port_1-rx_packets"`
		//Port1TxBytes   int64     `json:"port_1-tx_bytes"`
		//Port1TxPackets int       `json:"port_1-tx_packets"`
		RxBroadcast float64 `json:"rx_broadcast"`
		RxBytes     float64 `json:"rx_bytes"`
		RxCrypts    float64 `json:"rx_crypts"`
		RxDropped   float64 `json:"rx_dropped"`
		RxErrors    float64 `json:"rx_errors"`
		RxFrags     float64 `json:"rx_frags"`
		RxMulticast float64 `json:"rx_multicast"`
		RxPackets   float64 `json:"rx_packets"`
		SiteID      string  `json:"site_id"`
		Sw          string  `json:"sw"`
		Time        int64   `json:"time"`
		TxBroadcast float64 `json:"tx_broadcast"`
		TxBytes     float64 `json:"tx_bytes"`
		TxDropped   float64 `json:"tx_dropped"`
		TxErrors    float64 `json:"tx_errors"`
		TxMulticast float64 `json:"tx_multicast"`
		TxPackets   float64 `json:"tx_packets"`
		TxRetries   float64 `json:"tx_retries"`
	} `json:"stat"`
	State       DevState `json:"state"`
	StpPriority string   `json:"stp_priority"`
	StpVersion  string   `json:"stp_version"`
	SysStats    struct {
	} `json:"sys_stats"`
	SystemStats struct {
	} `json:"system-stats"`
	TxBytes           int64  `json:"tx_bytes"`
	Type              string `json:"type"`
	Upgradable        bool   `json:"upgradable"`
	UpgradeState      int    `json:"upgrade_state"`
	UpgradeToFirmware string `json:"upgrade_to_firmware"`
	Uplink            struct {
		FullDuplex  bool   `json:"full_duplex"`
		IP          string `json:"ip"`
		Mac         string `json:"mac"`
		MaxSpeed    int    `json:"max_speed"`
		Media       string `json:"media"`
		Name        string `json:"name"`
		Netmask     string `json:"netmask"`
		NumPort     int    `json:"num_port"`
		PortIdx     int    `json:"port_idx"`
		RxBytes     int64  `json:"rx_bytes"`
		RxBytesR    int    `json:"rx_bytes-r"`
		RxDropped   int    `json:"rx_dropped"`
		RxErrors    int    `json:"rx_errors"`
		RxMulticast int    `json:"rx_multicast"`
		RxPackets   int    `json:"rx_packets"`
		Speed       int    `json:"speed"`
		TxBytes     int64  `json:"tx_bytes"`
		TxBytesR    int    `json:"tx_bytes-r"`
		TxDropped   int    `json:"tx_dropped"`
		TxErrors    int    `json:"tx_errors"`
		TxPackets   int    `json:"tx_packets"`
		Type        string `json:"type"`
		Up          bool   `json:"up"`
	} `json:"uplink"`
	UplinkDepth            int    `json:"uplink_depth"`
	Uptime                 int    `json:"uptime"`
	UserNumSta             int    `json:"user-num_sta"`
	Version                string `json:"version"`
	VersionIncompatible    bool   `json:"version_incompatible"`
	XAuthkey               string `json:"x_authkey"`
	XFingerprint           string `json:"x_fingerprint"`
	XHasSSHHostkey         bool   `json:"x_has_ssh_hostkey"`
	XInformAuthkey         string `json:"x_inform_authkey"`
	XSSHHostkeyFingerprint string `json:"x_ssh_hostkey_fingerprint"`
	// contains filtered or unexported fields
}

Access point data

func (USW) DeviceName

func (s USW) DeviceName() string

func (USW) ModelName

func (s USW) ModelName() string

func (USW) Restart

func (s USW) Restart() error

Reboot access point

type USWmap

type USWmap map[string]USW

type Unifi

type Unifi struct {
	// contains filtered or unexported fields
}

func Login

func Login(user, pass, host, port, site string, version int) (*Unifi, error)

Initializes a session. Only controller versions 5 and newer are supported

func (*Unifi) AllUsers

func (u *Unifi) AllUsers(site *Site) ([]AllUser, error)

Returns a slice of all users

func (*Unifi) Aps

func (u *Unifi) Aps(site *Site) ([]UAP, error)

Returns a slice of access points Deprecated: Use UAPs instead

func (*Unifi) BasicAlarms

func (u *Unifi) BasicAlarms(site *Site, filter interface{}) ([]BasicEvent, error)

Returns a slice of json RawDevices as received by the controller

func (*Unifi) BasicEvents

func (u *Unifi) BasicEvents(site *Site, filter interface{}) ([]BasicEvent, error)

Returns a slice of json RawDevices as received by the controller

func (*Unifi) CreateBackup

func (u *Unifi) CreateBackup() error

func (*Unifi) DeviceMap

func (u *Unifi) DeviceMap(site *Site) (DeviceMap, error)

Returns a map of access points with mac as a key

func (*Unifi) Devices

func (u *Unifi) Devices(site *Site, filter string) ([]Device, error)

Returns a slice of devices

func (*Unifi) GetBackup

func (u *Unifi) GetBackup() error

func (*Unifi) Health

func (u *Unifi) Health(site *Site) (Health, error)

Returns a slice of access points

func (*Unifi) Logout

func (u *Unifi) Logout()

Terminates a session

func (*Unifi) NetworkMap

func (u *Unifi) NetworkMap(site *Site) (NetworkMap, error)

NetworkMap Returns a map of networkconfigs of a given site with ID as key

func (*Unifi) Networks

func (u *Unifi) Networks(site *Site) ([]Network, error)

Networks Returns a slice of known networks

func (*Unifi) NewVoucher

func (u *Unifi) NewVoucher(site *Site, nv NewVoucher) ([]Voucher, error)

func (*Unifi) PortProfile

func (u *Unifi) PortProfile(site *Site, name string) (*PortProfile, error)

Returns a map of networkconfigs with ID as key

func (*Unifi) PortProfileMap

func (u *Unifi) PortProfileMap(site *Site) (PortprofileMap, error)

Returns a map of networkconfigs with ID as key

func (*Unifi) PortProfiles

func (u *Unifi) PortProfiles(site *Site) ([]PortProfile, error)

Returns a slice of known portconfigs

func (*Unifi) RawAlarms

func (u *Unifi) RawAlarms(site *Site, filter interface{}) ([]RawAlarm, error)

Returns a slice of json RawDevices as received by the controller

func (*Unifi) RawDevices

func (u *Unifi) RawDevices(site *Site, filter string) ([]RawDevice, error)

Returns a slice of json RawDevices as received by the controller

func (*Unifi) RawEvents

func (u *Unifi) RawEvents(site *Site, filter interface{}) ([]RawEvent, error)

Returns a slice of json RawDevices as received by the controller

func (*Unifi) SetPortoverrides

func (u *Unifi) SetPortoverrides(site *Site, deviceid string, o []PortOverride) error

Sets the portoverrides of a given device

func (*Unifi) Site

func (u *Unifi) Site(desc string) (*Site, error)

Site returns a site with given name or description

func (*Unifi) Sites

func (u *Unifi) Sites() ([]Site, error)

Sites returns a slice with all sites of the controller

func (*Unifi) Sta

func (u *Unifi) Sta(site *Site) ([]Sta, error)

Returns a slice of stations

func (*Unifi) StaMap

func (u *Unifi) StaMap(site *Site) (StaMap, error)

Returns a map of stations with MAC as a key

func (*Unifi) UAPMap

func (u *Unifi) UAPMap(site *Site) (UAPmap, error)

Returns a map of access points with mac as a key

func (*Unifi) UAPs

func (u *Unifi) UAPs(site *Site) ([]UAP, error)

Returns a slice of access points

func (*Unifi) USW

func (u *Unifi) USW(site *Site, name string) (*USW, error)

Returns a USW pointer for USW with a given name

func (*Unifi) USWmap

func (u *Unifi) USWmap(site *Site) (USWmap, error)

Returns a map of access points with mac as a key

func (*Unifi) USWs

func (u *Unifi) USWs(site *Site) ([]USW, error)

Returns a slice of switches

func (*Unifi) UserGroups

func (u *Unifi) UserGroups(site *Site) ([]UserGroup, error)

Returns user groups

func (*Unifi) Users

func (u *Unifi) Users(site *Site) ([]User, error)

Returns a slice of known users

func (*Unifi) Voucher

func (u *Unifi) Voucher(site *Site) ([]Voucher, error)

func (*Unifi) VoucherMap

func (u *Unifi) VoucherMap(site *Site) (VoucherMap, error)

func (*Unifi) WlanConf

func (u *Unifi) WlanConf(site *Site) ([]WlanConf, error)

Returns a Wlan config

type Uplink struct {
	FullDuplex  bool   `json:"full_duplex"`
	IP          string `json:"ip"`
	Mac         string `json:"mac"`
	MaxSpeed    int    `json:"max_speed"`
	Name        string `json:"name"`
	Netmask     string `json:"netmask"`
	NumPort     int    `json:"num_port"`
	RxBytes     int64  `json:"rx_bytes"`
	RxBytesR    int    `json:"rx_bytes-r"`
	RxDropped   int    `json:"rx_dropped"`
	RxErrors    int    `json:"rx_errors"`
	RxMulticast int    `json:"rx_multicast"`
	RxPackets   int    `json:"rx_packets"`
	Speed       int    `json:"speed"`
	TxBytes     int64  `json:"tx_bytes"`
	TxBytesR    int    `json:"tx_bytes-r"`
	TxDropped   int    `json:"tx_dropped"`
	TxErrors    int    `json:"tx_errors"`
	TxPackets   int    `json:"tx_packets"`
	Type        string `json:"type"`
	Up          bool   `json:"up"`
}

Unifi API Version 5.7.20

type UplinkTable

type UplinkTable struct {
}

type User

type User struct {
	FirstSeen int `json:"first_seen"`
	Hostname  string
	IsGuest   bool `json:"is_guest"`
	LastSeen  int  `json:"last_seen"`
	Mac       string
	Oui       string
}

type UserGroup

type UserGroup struct {
	AttrHiddenID    string `json:"attr_hidden_id"`
	AttrNoDelete    bool   `json:"attr_no_delete"`
	DownRateEnabled bool   `json:"downrate_enabled"`
	Name            string
	QosRateMaxDown  int  `json:"qos_rate_max_down"`
	QosRateMaxUp    int  `json:"qos_rate_max_up"`
	UpRateEnabled   bool `json:"uprate_enabled"`
}

type VPN

type VPN struct {
	Status    string `json:"status"`
	Subsystem string `json:"subsystem"`
}

type Voucher

type Voucher struct {
	AdminName    string `json:"admin_name"`
	Code         string
	CreateTime   int `json:"create_time"`
	Duration     int
	ForHotspot   bool `json:"for_hotspot"`
	Note         string
	QosOverwrite bool `json:"qos_overwrite"`
	Quota        int
	SiteID       string `json:"site_id"`
	Used         int
	// contains filtered or unexported fields
}

type VoucherMap

type VoucherMap map[string]Voucher

type VwireTable

type VwireTable struct {
}

type WAN

type WAN struct {
	Gateways      []string `json:"gateways"`
	GwMac         string   `json:"gw_mac"`
	GwName        string   `json:"gw_name"`
	GwSystemStats struct {
		CPU   string `json:"cpu"`
		Mem   string `json:"mem"`
		Temps struct {
			BoardCPU string `json:"Board (CPU)"`
			BoardPHY string `json:"Board (PHY)"`
			CPU      string `json:"CPU"`
			PHY      string `json:"PHY"`
		} `json:"temps"`
		Uptime string `json:"uptime"`
	} `json:"gw_system-stats"`
	GwVersion       string   `json:"gw_version"`
	Nameservers     []string `json:"nameservers"`
	Netmask         string   `json:"netmask"`
	NumAdopted      int      `json:"num_adopted"`
	NumDisconnected int      `json:"num_disconnected"`
	NumGw           int      `json:"num_gw"`
	NumPending      int      `json:"num_pending"`
	NumSta          int      `json:"num_sta"`
	RxBytesR        int      `json:"rx_bytes-r"`
	Status          string   `json:"status"`
	Subsystem       string   `json:"subsystem"`
	TxBytesR        int      `json:"tx_bytes-r"`
	WanIP           string   `json:"wan_ip"`
}

type WLAN

type WLAN struct {
	NumAdopted      int    `json:"num_adopted"`
	NumAp           int    `json:"num_ap"`
	NumDisabled     int    `json:"num_disabled"`
	NumDisconnected int    `json:"num_disconnected"`
	NumGuest        int    `json:"num_guest"`
	NumPending      int    `json:"num_pending"`
	NumUser         int    `json:"num_user"`
	RxBytesR        int    `json:"rx_bytes-r"`
	Status          string `json:"status"`
	Subsystem       string `json:"subsystem"`
	TxBytesR        int    `json:"tx_bytes-r"`
}

type WWW

type WWW struct {
	Drops            int     `json:"drops"`
	GwMac            string  `json:"gw_mac"`
	Latency          int     `json:"latency"`
	RxBytesR         int     `json:"rx_bytes-r"`
	SpeedtestLastrun int     `json:"speedtest_lastrun"`
	SpeedtestPing    int     `json:"speedtest_ping"`
	SpeedtestStatus  string  `json:"speedtest_status"`
	Status           string  `json:"status"`
	Subsystem        string  `json:"subsystem"`
	TxBytesR         int     `json:"tx_bytes-r"`
	Uptime           int     `json:"uptime"`
	XputDown         float64 `json:"xput_down"`
	XputUp           float64 `json:"xput_up"`
}

type Wan

type Wan struct {
	BytesR      int      `json:"bytes-r"`
	DNS         []string `json:"dns"`
	Enable      bool     `json:"enable"`
	FullDuplex  bool     `json:"full_duplex"`
	Gateway     string   `json:"gateway"`
	Ifname      string   `json:"ifname"`
	IP          string   `json:"ip"`
	Mac         string   `json:"mac"`
	MaxSpeed    int      `json:"max_speed"`
	Name        string   `json:"name"`
	Netmask     string   `json:"netmask"`
	RxBytes     int64    `json:"rx_bytes"`
	RxBytesR    int      `json:"rx_bytes-r"`
	RxDropped   int      `json:"rx_dropped"`
	RxErrors    int      `json:"rx_errors"`
	RxMulticast int      `json:"rx_multicast"`
	RxPackets   int      `json:"rx_packets"`
	Speed       int      `json:"speed"`
	TxBytes     int64    `json:"tx_bytes"`
	TxBytesR    int      `json:"tx_bytes-r"`
	TxDropped   int      `json:"tx_dropped"`
	TxErrors    int      `json:"tx_errors"`
	TxPackets   int      `json:"tx_packets"`
	Type        string   `json:"type"`
	Up          bool     `json:"up"`
}

type WlanConf

type WlanConf struct {
	Enabled        bool
	HideSsid       bool `json:"hide_ssid"`
	IsGuest        bool `json:"is_guest"`
	Name           string
	RadiusIP1      string `json:"radius_ip_1"`
	RadiusPort1    string `json:"radius_port_1"`
	Security       string
	UsergroupID    string `json:"usergroup_id"`
	Vlan           string
	VlanEnabled    bool   `json:"vlan_enabled"`
	WepIdx         string `json:"wep_idx"`
	WpaEnc         string `json:"wpa_enc"`
	WpaMode        string `json:"wpa_mode"`
	XPassphrase    string `json:"x_passphrase"`
	XRadiusSecret1 string `json:"x_radius_secret_1"`
	XWep           string `json:"x_wep"`
}

Directories

Path Synopsis
cmd
disable-port
Example command disable-port Disables a port of a USW
Example command disable-port Disables a port of a USW
list-alarms
Example command list-events List Events of a given site
Example command list-events List Events of a given site
list-clients
Example command list-clients list associated clients (stations) of a given site
Example command list-clients list associated clients (stations) of a given site
list-devices
Example command list-devices List devices of a given site
Example command list-devices List devices of a given site
list-events
Example command list-events List Events of a given site
Example command list-events List Events of a given site
list-health
Example command list-health list controller health information
Example command list-health list controller health information
list-portoverrides
Example command list port-overrides list port-overrides of a given device
Example command list port-overrides list port-overrides of a given device
list-portprofiles
Example command list-portprofile list portprofiles of a given site
Example command list-portprofile list portprofiles of a given site
list-rawdevices
Example command list-rawdevices Generates a json file with a list of devices as received by the controller api.
Example command list-rawdevices Generates a json file with a list of devices as received by the controller api.
list-sites
Example command list-sites List sites of a given controller
Example command list-sites List sites of a given controller
list-uaps
Example command list-aps List APs of a given site
Example command list-aps List APs of a given site
list-usws
Example command list-usws List USWs of a given site
Example command list-usws List USWs of a given site
log-roaming
Example command log-roaming log stations of a given site as they roam
Example command log-roaming log stations of a given site as they roam

Jump to

Keyboard shortcuts

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