unifi

package
v0.0.0-...-0ad0588 Latest Latest
Warning

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

Go to latest
Published: May 20, 2020 License: BSD-2-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient() Client

func (*Client) FetchDashboard

func (this *Client) FetchDashboard() ([]DashboardInfo, error)

func (*Client) FetchDevices

func (this *Client) FetchDevices() ([]UnifiClient, error)

func (*Client) FetchStatistics

func (this *Client) FetchStatistics(start time.Time, end time.Time) ([]StatisticsInfo, error)

func (*Client) Login

func (this *Client) Login(addr string, port string, user string, pass string) error

type ClientResponse

type ClientResponse struct {
	Data []UnifiClient
	Meta struct {
		Rc string
	}
}

type DashboardInfo

type DashboardInfo struct {
	LatencyAvg *float64 `json:"latency_avg"`
	LatencyMax float64  `json:"latency_max"`
	LatencyMin float64  `json:"latency_min"`
	MaxBytesRx float64  `json:"max_rx_bytes-r"`
	MaxBytesTx float64  `json:"max_tx_bytes-r"`
	RxBytes    int64    `json:"rx_bytes-r"`

	// epoch time, milliseconds
	Time       int64   `json:"time"`
	TxBytes    int64   `json:"tx_bytes-r"`
	WanRxBytes float64 `json:"wan-rx_bytes"`
	WanTxBytes float64 `json:"wan-tx_bytes"`
}

type DashboardResponse

type DashboardResponse struct {
	Data []DashboardInfo
	Meta struct {
		Rc string
	}
}

type DpiStat

type DpiStat struct {
	App       int64
	Cat       int64
	RxBytes   int64
	RxPackets int64
	TxBytes   int64
	TxPackets int64
}

DpiStat is for deep packet inspection stats

type StatisticsInfo

type StatisticsInfo struct {
	Oid  string
	Site string

	// epoch time, milliseconds
	Time int64 `json:"time"`

	WlanNumSta int64   `json:"wlan-num_sta"`
	WlanBytes  float64 `json:"wlan_bytes"`
}

type StatisticsResponse

type StatisticsResponse struct {
	Data []StatisticsInfo
	Meta struct {
		Rc string
	}
}

type UnifiClient

type UnifiClient struct {
	ID                  string `json:"_id"`
	IsGuestByUAP        bool   `json:"_is_guest_by_uap"`
	IsGuestByUGW        bool   `json:"_is_guest_by_ugw"`
	LastSeenByUAP       int64  `json:"_last_seen_by_uap"`
	LastSeenByUGW       int64  `json:"_last_seen_by_ugw"`
	UptimeByUAP         int64  `json:"_uptime_by_uap"`
	UptimeByUGW         int64  `json:"_uptime_by_ugw"`
	ApMac               string `json:"ap_mac"`
	AssocTime           int64  `json:"assoc_time"`
	Authorized          bool
	Bssid               string
	BytesR              int64 `json:"bytes-r"`
	Ccq                 int64
	Channel             int64
	DpiStats            []DpiStat `json:"dpi_stats"`
	DpiStatsLastUpdated int64     `json:"dpi_stats_last_updated"`
	Essid               string
	FirstSeen           int64  `json:"first_seen"`
	FixedIP             string `json:"fixed_ip"`
	Hostname            string
	GwMac               string `json:"gw_mac"`
	IdleTime            int64  `json:"idle_time"`
	Ip                  string
	IsGuest             bool  `json:"is_guest"`
	IsWired             bool  `json:"is_wired"`
	LastSeen            int64 `json:"last_seen"`
	LatestAssocTime     int64 `json:"latest_assoc_time"`
	Mac                 string
	Name                string
	Network             string
	NetworkID           string `json:"network_id"`
	Noise               int64
	Oui                 string
	PowersaveEnabled    bool `json:"powersave_enabled"`
	QosPolicyApplied    bool `json:"qos_policy_applied"`
	Radio               string
	RadioProto          string `json:"radio_proto"`
	RoamCount           int64  `json:"roam_count"`
	Rssi                int64
	RxBytes             int64 `json:"rx_bytes"`
	RxBytesR            int64 `json:"rx_bytes-r"`
	RxPackets           int64 `json:"rx_packets"`
	RxRate              int64 `json:"rx_rate"`
	Signal              int64
	SiteID              string `json:"site_id"`
	TxBytes             int64  `json:"tx_bytes"`
	TxBytesR            int64  `json:"tx_bytes-r"`
	TxPackets           int64  `json:"tx_packets"`
	TxPower             int64  `json:"tx_power"`
	TxRate              int64  `json:"tx_rate"`
	Uptime              int64
	UserID              string `json:"user_id"`
	Vlan                int64
}

Jump to

Keyboard shortcuts

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